A component that adds custom attributes to articles, categories, menu items, modules, plugins, users and other Joomla elements. Values are output with shortcodes or through an API.
The Attributes component lets you define your own additional attributes for standard Joomla elements and then output their values on the site. Attribute values are stored in the parameters of the corresponding element, with no separate tables.
Features
- Attributes for the global configuration, menu items, users, contacts, articles, categories, modules, plugins, fields and tags.
- Value types: text, multi-line text, editor, list (including multiple choice), image.
- Output of a value in content via the
{attrs;dest;id;attrName}shortcode, wheredestis system, menu, users, contacts, articles, categories, modules or plugins. - Access to a value in code via the
AttrsHelperhelper class.
Usage example
Suppose an attribute named test has been created for the article with ID 5.
To output its value in the article text, insert the shortcode {attrs;articles;5;test} in the editor.
To get the value in code (for example, in a template override), use the helper class:
JLoader::register('AttrsHelper', JPATH_ADMINISTRATOR . '/components/com_attrs/helpers/attrs.php');
$attrValue = AttrsHelper::getAttr('test', AttrsHelper::ATTR_DEST_ARTICLES, 5);
Compatibility and requirements
- Joomla 3 (3.7 or later).
- The package contains the component and a system plugin; the plugin processes shortcodes and is enabled automatically on installation.