CW Field Display

Add a CW Field Display module to any page(s) on your site

  1. In the Joomla administrator, go to Extensions > Modules and click "New" to add a new module.
  2. Select the CW Field Display module type.

Parameters Explained

  • Context: Enter the context for the field(s) to display. Leave blank to use the current page's context. Joomla core supports the following contexts relavent to this module: com_content.article, com_content.categories, com_users.user,, and com_contact.categories
  • Item ID: Enter the item ID of the item associated with the field(s) to display. Leave blank to use the current page's ID or the current user's ID if the com_users.user context is to be used.
  • Field(s): Enter the name(s) of the field(s) you want to display. If you enter multiple names, separate them by a comma. Leave blank to display all fields or all fields from the group(s) entered in the Field Group(s) parameter.
  • Field Group(s): Enter the ID(s) of the field group(s) you want to display. Leave blank to include all field groups.

Creating a Template Override

If you want to override the standard layout, you have to create a template override as follows:

  1. Copy /modules/mod_cw_fielddisplay/tmpl/default.php to /templates/{YOUR_TEMPLATE}/html/mod_cw_fielddisplay/default.php *
  2. Modify as needed

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(
        '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.