Skip to content

Commit

Permalink
Added Feature items filter to mod_articles_news
Browse files Browse the repository at this point in the history
The feature item filter was already available for the
mod_articles_latest module, but that is just a list.
All code was slightly modified from the mod_articles_latest module.

Language File - Added three variables (description, lable and value)
Helper - Copy and pasted the switch from mod_articles_latest (same
parameter ordering too)
Parameter file - Added field after order (mirroring _latest)
  • Loading branch information
nickyeoman committed Aug 10, 2016
1 parent 540a3bc commit b0e6d3d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions language/en-GB/en-GB.mod_articles_news.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
; Note : All ini files need to be saved as UTF-8

MOD_ARTICLES_NEWS="Articles - Newsflash"
MOD_ARTICLES_NEWS_FIELD_FEATURED_DESC="Show or hide articles designated as featured."
MOD_ARTICLES_NEWS_FIELD_FEATURED_LABEL="Featured Articles"
MOD_ARTICLES_NEWS_FIELD_CATEGORY_DESC="Select Articles from a specific Category or a set of Categories. If no selection will show all categories as default."
MOD_ARTICLES_NEWS_FIELD_IMAGES_DESC="Display Article images."
MOD_ARTICLES_NEWS_FIELD_IMAGES_LABEL="Show Images"
Expand All @@ -27,4 +29,5 @@ MOD_ARTICLES_NEWS_READMORE="Read more ..."
MOD_ARTICLES_NEWS_READMORE_REGISTER="Register to Read More"
MOD_ARTICLES_NEWS_TITLE_HEADING="Header Level"
MOD_ARTICLES_NEWS_TITLE_HEADING_DESCRIPTION="Select the desired HTML header level for the Article titles."
MOD_ARTICLES_NEWS_VALUE_ONLY_SHOW_FEATURED="Only show Featured Articles"
MOD_ARTICLES_NEWS_XML_DESCRIPTION="The Article Newsflash Module will display a fixed number of Articles from a specific Category or a set of Categories."
14 changes: 14 additions & 0 deletions modules/mod_articles_news/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ public static function getList(&$params)
// Filter by language
$model->setState('filter.language', $app->getLanguageFilter());

// Featured switch
switch ($params->get('show_featured'))
{
case '1' :
$model->setState('filter.featured', 'only');
break;
case '0' :
$model->setState('filter.featured', 'hide');
break;
default :
$model->setState('filter.featured', 'show');
break;
}

// Set ordering
$ordering = $params->get('ordering', 'a.publish_up');
$model->setState('list.ordering', $ordering);
Expand Down
12 changes: 12 additions & 0 deletions modules/mod_articles_news/mod_articles_news.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@
default="5"
/>

<field
name="show_featured"
type="list"
label="MOD_ARTICLES_NEWS_FIELD_FEATURED_LABEL"
description="MOD_ARTICLES_NEWS_FIELD_FEATURED_DESC"
default=""
>
<option value="">JSHOW</option>
<option value="0">JHIDE</option>
<option value="1">MOD_ARTICLES_NEWS_VALUE_ONLY_SHOW_FEATURED</option>
</field>

<field
name="ordering"
type="list"
Expand Down

0 comments on commit b0e6d3d

Please sign in to comment.