Plug-in Show content class element usage

This plug-in help you to identify unused elements in a content class for later deletion.  It gives an overview which element is used in which Template Variant source code. Unused elements are displayed as yellow rows in the matrix table.

It shows a matrix of all elements by name and type and checks every Template Variant source code of the selected content class if the element is used. An element is considered to be used, if the element value itself or the red dot for this element is used.

The  interpretation is up to the admin. Even an element is not used in any Template Variant, it cannot be deleted.

Benefits
After a while working on different content classes (or after creational work on new content classes) it is a good time for a re-factoring usually. This plug-in helped me a lot to identify unused elements, which I can delete. This keeps the number of elements as small as possible and didn’t confuses the content class developer with not needed elements anymore.

Location in SmartTree
You found the plug-in under Administer Content Classes > Folder > at every content class.

How it works
First, you need to navigate to the content class you want to investigate. Start the plug-in and it will immediately collect all content class elements and template variants and comes back to with a 2 dimensional matrix between these both.

(The title of this plug-in still uses the old name template instead of content class, because of the time of writing this plug-in this was the correct name.)

Beside element name and type you get right of column “Used?” one column for every Template Variant the selected content class have.

Each of this Template Variant columns show yes on an element row, if the element itself or it’s red dot is used, otherwise it will be blank. Blank means the element is not used!

Very important is the 3. column, because it aggregates all Template Variant column values. A no in 3. column is displayed in yellow, because these are the elements which might be deleted, because they are unsed.

Installation
This plug-in can be installed using the combined setup routine for all jRQL API based plug-ins. Follow the instructions in this blog to download the installer and configure the plug-ins you want.

For API developers
The functionality in in 3.rd column is backed by the method Template > usesTemplateElement().

The check per Template Variant is delivered by the method TemplateVariant > usesTemplateCodeElement().

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: