Outputting Attributes for Squiz Matrix Assets when they have no Keyword
2 minutes 49 seconds average read (563 words)This is to test if I can output the Description attribute of Squiz Matrix Metadata Field Asset, using the keyword %globals_asset_attribute_description:xxxxxx%
. It turns out there is not a Keyword Replacement for this attribute along with many others.
An example of some of the attributes available on a metadata field are as follows:
- Field Name
- Friendly Name
- Description
- Field Type
- Scheme
- Language
- Character Limit
- Width
- Text for Name Attribute
- Text for Value Attribute

Why am I doing this?
So I want to build an interface within Admin Mode and Edit+ that uses a Metadata Field for some setting so I want to use:
- Friendly Name - to display a nice name for the field that may contain spaces, special characters, etc.
- Description - to display a tool tip to the editor so they understand what to do
- Field Name - to enable targeting with JS or CSS
- Required - so that can do some validation
Attribute Outputs
Unfortunately not all of these attributes have keywords.
Field Name
Keyword: globals_asset_name:2473
Output: description
Works: yes
Friendly Name
Keyword: globals_asset_attribute_friendly_name:2473
Output: Description
Works: yes
Description
Keyword: globals_asset_attribute_description:2473
Output:
Works: no
Field Type
Keyword: globals_asset_attribute_field_type:2473
Output:
Works: no
Scheme
Keyword: globals_asset_attribute_scheme:2473
Output:
Works: no
Language
Keyword: globals_asset_attribute_language:2473
Output:
Works: no
Character Limit
Keyword: globals_asset_attribute_char_limit:2473
Output:
Works: no
Width
Keyword: globals_asset_attribute_width:2473
Output:
Works: no
Text for Name Attribute
Keyword: globals_asset_attribute_field_name_text:2473
Output:
Works: no
Text for Value Attribute
Keyword: globals_asset_attribute_value_name_text:2473
Output:
Works: no
Required
Keyword: globals_asset_attribute_required:2473
Output:
Works: no
Height
Keyword: globals_asset_attribute_box_height:2473
Output:
Works: no
Default
Keyword: globals_asset_attribute_default:2473
Output:
Works: no
Is Contextable
Keyword: globals_asset_attribute_is_contextable:2473
Output:
Works: no
Editable
Keyword: globals_asset_attribute_editable:2473
Output:
Works: no
Allow Cascading
Keyword: globals_asset_attribute_allow_cascading:2473
Output:
Works: no
Tag Format
Keyword: globals_asset_attribute_tag_format:2473
Output:
Works: no
Show on Frontend
Keyword: globals_asset_attribute_frontend:2473
Output:
Works: no
Multiple Line
Keyword: globals_asset_attribute_multi_line:2473
Output:
Works: no
Using Asset Data Keyword
Raw Output of globals_asset_data_attributes:2473
{"name":{"attrid":"978","type":"text","value":"description","is_contextable":false,"use_default":true},"friendly_name":{"attrid":"983","type":"text","value":"Description","is_contextable":true,"use_default":true},"default":{"attrid":"986","type":"text","value":"","is_contextable":true,"use_default":true},"scheme":{"attrid":"984","type":"text","value":"","is_contextable":false,"use_default":true},"is_contextable":{"attrid":"989","type":"boolean","value":true,"is_contextable":false,"use_default":true},"allow_cascading":{"attrid":"4477","type":"boolean","value":true,"is_contextable":false,"use_default":true},"frontend":{"attrid":"982","type":"selection","value":"show","is_contextable":false,"use_default":true},"tag_format":{"attrid":"4754","type":"text","value":"","is_contextable":true,"use_default":true},"show_use_default":{"attrid":"4910","type":"boolean","value":true,"is_contextable":false,"use_default":true},"box_height":{"attrid":"994","type":"int","value":"7","is_contextable":false,"use_default":true},"description":{"attrid":"988","type":"text","value":"Enter a brief description of this page, no more than 155 characters.","is_contextable":true,"use_default":true},"language":{"attrid":"990","type":"text","value":"","is_contextable":true,"use_default":true},"value_components":{"attrid":"979","type":"serialise","value":[],"is_contextable":true,"use_default":true},"editable":{"attrid":"987","type":"boolean","value":true,"is_contextable":false,"use_default":true},"required":{"attrid":"980","type":"boolean","value":false,"is_contextable":false,"use_default":true},"field_name_text":{"attrid":"981","type":"text","value":"name","is_contextable":true,"use_default":true},"value_name_text":{"attrid":"985","type":"text","value":"content","is_contextable":true,"use_default":true},"multi_line":{"attrid":"991","type":"boolean","value":false,"is_contextable":false,"use_default":true},"field_type":{"attrid":"4860","type":"selection","value":"single","is_contextable":false,"use_default":true},"char_limit":{"attrid":"992","type":"int","value":"155","is_contextable":false,"use_default":true},"box_width":{"attrid":"993","type":"int","value":"30","is_contextable":false,"use_default":true}}
Beautified Output of globals_asset_data_attributes:2473
{ "value_name_text":{ "attrid":"985", "type":"text", "value":"content", "is_contextable":true, "use_default":true }, "name":{ "attrid":"978", "type":"text", "value":"description", "is_contextable":false, "use_default":true }, "box_height":{ "attrid":"994", "type":"int", "value":"7", "is_contextable":false, "use_default":true }, "description":{ "attrid":"988", "type":"text", "value":"Enter a brief description of this page, no more than 155 characters.", "is_contextable":true, "use_default":true }, "default":{ "attrid":"986", "type":"text", "value":"", "is_contextable":true, "use_default":true }, "language":{ "attrid":"990", "type":"text", "value":"", "is_contextable":true, "use_default":true }, "value_components":{ "attrid":"979", "type":"serialise", "value":[], "is_contextable":true, "use_default":true }, "is_contextable":{ "attrid":"989", "type":"boolean", "value":true, "is_contextable":false, "use_default":true }, "required":{ "attrid":"980", "type":"boolean", "value":false, "is_contextable":false, "use_default":true }, "friendly_name":{ "attrid":"983", "type":"text", "value":"Description", "is_contextable":true, "use_default":true }, "scheme":{ "attrid":"984", "type":"text", "value":"", "is_contextable":false, "use_default":true }, "editable":{ "attrid":"987", "type":"boolean", "value":true, "is_contextable":false, "use_default":true }, "allow_cascading":{ "attrid":"4477", "type":"boolean", "value":true, "is_contextable":false, "use_default":true }, "tag_format":{ "attrid":"4754", "type":"text", "value":"", "is_contextable":true, "use_default":true }, "field_name_text":{ "attrid":"981", "type":"text", "value":"name", "is_contextable":true, "use_default":true }, "frontend":{ "attrid":"982", "type":"selection", "value":"show", "is_contextable":false, "use_default":true }, "multi_line":{ "attrid":"991", "type":"boolean", "value":false, "is_contextable":false, "use_default":true }, "char_limit":{ "attrid":"992", "type":"int", "value":"155", "is_contextable":false, "use_default":true }, "box_width":{ "attrid":"993", "type":"int", "value":"30", "is_contextable":false, "use_default":true }, "field_type":{ "attrid":"4860", "type":"selection", "value":"single", "is_contextable":false, "use_default":true } }
Using Keyword Modifiers to target individual attributes
The ^index
keyword modifier can be used to output the attribute's of each attribute, such as:
- Value
- Type
- Is Contextable
{"attrid":"988","type":"text","value":"Enter a brief description of this page, no more than 155 characters.","is_contextable":true,"use_default":true}
Beautified Output
{ "attrid":"988", "type":"text", "value":"Enter a brief description of this page, no more than 155 characters.", "is_contextable":true, "use_default":true }
We can use it multiple times to grab the attribute's attributes
Enter a brief description of this page, no more than 155 characters.
Conclusion
Even though every attribute does not have a keyword replacement, e.g. globals_asset_attribute_description:1234
, we can get these values from the globals_asset_data_attributes:1234
and use keyword modifier ^index
to target what we do need.