Title_Mask_Configuration

Jason Pell edited this page Jun 21, 2013 · 1 revision

Title mask functionality is available in the login whats new, listings, borrow functionality and site plugins. This functionality allows you to configure what attributes are displayed [with] the item title in the item title column/field.

Table of Contents

Mask Structure

Each variable mask element is enclosed in curly braces, this is required for simple variables as well as for mask functions.

Variables

All should be lowercase and match the s_attribute_type of the item_attribute you want included.

In the most basic example, you would include the ALT_TITLE attribute of an item thus:

  • {alt_title}

Lookup table variable options

As well as normal variables, you can also specify that you want to display the attribute in a particular format.

This will only work for attributes that are sourced from a lookup widget. (A widget that is populated from the s_attribute_type_lookup table)

At item_attribute.attribute_val, you can use 'img', 'value' and 'display', thus:

  • {s_attribute_type.img}
  • {s_attribute_type.value}
  • {s_attribute_type.display}
These correspond to the s_attribute_type_lookup columns of the same name, for the item_attribute.

At s_item_type, you can use 'prompt', which will return the s_item_attribute_type.prompt, or s_attribute_type if not defined.

  • {s_attribute_type.prompt}

Mask functions

There are currently several functions that you can use.

ifdef(varname, 'if_mask'[,'else_mask'])

If the specified s_attribute_type is set in the item as an item_attribute, then the 'mask' parameter. which can have embedded mask variables (but not mask functions) will be displayed, otherwise nothing.

You CANNOT specify 'title', 's_status_type', 's_item_type', 'item_id' or 'instance_no' for varname.

if(varname op value, 'if_mask'[,'else_mask'])

The op is one of '<=', '=', '>', '==', '!='.

If either the varname value or value is empty/null this function will evaluate to FALSE.

If you want to test for emptiness, use 'ifdef', as this is exactly what this function tests. In actuality the 'ifdef' function actually test if an item_attribute record for the specified type even exists, but because the item_input.php does not insert records that have an empty value AND deletes those that are set to empty, the ifdef does provide the same functionaliy as an 'isnull' function might.

You CAN specify 's_item_type', 's_status_type', 'instance_no' for varname. You CANNOT specify 'title' or 'item_id' though.

switch(varname, value, statement[value,][,...][,])

Does a simple comparison of the value of varname, to each of the value strings in the switch, and when a match is made, the corresponding statement is evaluated and the value returned. If no matches, and a default_statement is defined, this is evaluated instead. Be sure to get the order right, as an incorrect order will have unpredictable results.

The switch value, must be a simple string, it cannot be a submask statement in and of itself, nor a if comparison for instance, this is a simple C like switch statement.

theme_img(img, prompt_expression)

The img, should be a relative path image, that can be found using the functions/theme.php::_theme_image_src($src) function algorithm.

The prompt_expression, can be any expression that returns a string, which means embedding another call to theme_img is not a good idea, and will not be handled properly.

Examples of what to specify include:

  • year.value - Will return the year of the current item.
  • dvd_extras.prompt - The system data prompt, for example 'Extras'.
Note: Any theme_img which can be resolved at s_item_type level will be included in the help section of listings.php.

Tips

In order to use embedded functions in if, ifdef function calls you need to enclose them in {...} brackets.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.