• Making the cut with jQuery and MooTools in Joomla: The multiple jQuery libraries loading problem - Part 1

    Although the two libraries MooTools and jQuery can co-exist together, one problem remains as more and more such extensions are made available: each module, plugin, component or even template can come...

Add your own information types in Latest News Enhanced Pro

Latest News Enhanced Pro
First published January 13, 2017
980 hits -


Module Latest News Enhanced Pro Latest News Enhanced Pro v2.5+
Plugin MyDetails MyDetails

It is possible to show custom information to the module's output for each item.

In order to do that, one can take advantage of 2 of the hooks (events) available in the module.

First, one need to be able to add the field type in the list of fields available for output and second, one need to set how the output will present itself for each module item.

Throughout this tutorial and looking through the code of the plugin, you will be able to add:

  • a field type that can render an article or K2 item title,
  • a field type that outputs a link,
  • a field type that outputs the meta description of an article or K2 item, if available,
  • a field type that can query a database table for getting a specific value.

Information types

Please download the sample code to use as a base for your own customizations.

You can use the plugin plg_latestnewsenhanced_mydetails as-is, the only changes that you will need to make are located in the files mydetails.php and en-GB.plg_latestnewsenhanced_mydetails.sys.ini.

The plugin can easily be internationalized by adding your onw language files to it (in this case, mydetails.xml will need to be updated accordingly).

Step 1 Install the plugin (not on a production site).

Step 2 Open the file mydetails.php. The code is documented with key information.

Step 3 Go to the method onLatestNewsEnhancedPrepareDetailSelection. This is the code that will be called whenever the select box containing all the information types is created.

Step 4 Add the name of the type you want to see as information type to the array of information types.

$information_types[] = '[information type]';

Note The information type is made of the plugin name _ the type.
For instance : mydetails_title.

Step 5 Go to the method onLatestNewsEnhancedGetDetailData. This is the code that will be called whenever items are shown on the page. For parameter explanations, check the source code.

Step 6 Add the html code and data to the block that will be shown when selecting the information type. A classic output bloc will look like this:

if ($detail[0] == '[information type]') {
    $info_block = '<span class="detail detail_[information type]">';
    $info_block .= modLatestNewsEnhancedExtendedHelper::getPreData($detail[1], $detail[2], '[default icon]', $detail[3]);
    $info_block .= '<span class="detail_data">';
    $info_block .= '[content output]';
    $info_block .= '</span>';
    $info_block .= '</span>';
    return $info_block;

For the list of available icons, go to documentation/common-features/icon-picker-common.

Step 7 Save your code.

Step 8 Open the file en-GB.plg_latestnewsenhanced_mydetails.sys.ini.

Step 9 Add the key/value pair that corresponds to the information type that you have created. Follow the convention: PLG_LATESTNEWSENHANCED_[plugin name]_DETAIL_LABEL_[information type]

You will get the following output for this sample plugin:


More information is available in the module's documentation, under the Extend the module section.