CW Field Display is a simple module for displaying a Joomla custom field or fields from a specific context and item.
With CW Field Display, you can either set a specific context and item ID in the module parameters, or allow it to use the current page's context and item ID. You can also set specific fields or field groups to be displayed or allow it to display all custom fields. This module gives you greater control over how and where you display custom fields on each page because it makes it possible to display custom fields outside of the component's output.
Need help? Check out our documentation.
Add a CW Field Display module to any page(s) on your site
Parameters Explained
com_content.article
, com_content.categories
, com_users.user
, com_contact.contact
, and com_contact.categories
com_users.user
context is to be used.Creating a Template Override
If you want to override the standard layout, you have to create a template override as follows:
/modules/mod_cw_fielddisplay/tmpl/default.php
to /templates/{YOUR_TEMPLATE}/html/mod_cw_fielddisplay/default.php
*The default output calls the standard layout to render all fields from com_fields
. You can override this to render each field individually by looping through the $fields
array variable that is passed to the layout. Each field in the array is a standard object, and has a "value" parameter and a "rawvalue" parameter. The "value" parameter is rendered through the field type's output layout, and the "rawvalue" parameter is the raw value entered for the field by the admin.
You may also use FieldsHelper::render
to render a single field using the following:
echo FieldsHelper::render( $context, 'field.render', array( 'field' => $field ) );
This is assuming that $field
is the variable you get when looping through the $fields
array.
* Note: If you want to have multiple template overrides, you can create multiple copies of default.php
, but give it different names. Each new override will be available in as an option in the Alternate Layout parameter in the Advanced parameter tab in the module.