diff --git a/language/en-GB/en-GB.mod_articles_category.ini b/language/en-GB/en-GB.mod_articles_category.ini index 018eb4e2219bb..e4fc42a65a3e8 100644 --- a/language/en-GB/en-GB.mod_articles_category.ini +++ b/language/en-GB/en-GB.mod_articles_category.ini @@ -35,6 +35,8 @@ MOD_ARTICLES_CATEGORY_FIELD_DATEFIELDFORMAT_DESC="Please enter in a valid date f MOD_ARTICLES_CATEGORY_FIELD_DATEFIELDFORMAT_LABEL="Date Format" MOD_ARTICLES_CATEGORY_FIELD_DATEFILTERING_DESC="Select Date Filtering Type." MOD_ARTICLES_CATEGORY_FIELD_DATEFILTERING_LABEL="Date Filtering" +MOD_ARTICLES_CATEGORY_FIELD_DATEGROUPINGFIELD_DESC="Select which date field you want the date grouping to be applied to." +MOD_ARTICLES_CATEGORY_FIELD_DATEGROUPINGFIELD_LABEL="Date Grouping Field" MOD_ARTICLES_CATEGORY_FIELD_ENDDATE_DESC="Please enter an End Date." MOD_ARTICLES_CATEGORY_FIELD_ENDDATE_LABEL="To Date" MOD_ARTICLES_CATEGORY_FIELD_EXCLUDEDARTICLES_DESC="Please enter each Article ID on a new line." @@ -98,4 +100,4 @@ MOD_ARTICLES_CATEGORY_OPTION_YEAR_VALUE="Year" MOD_ARTICLES_CATEGORY_READ_MORE="Read more: " MOD_ARTICLES_CATEGORY_READ_MORE_TITLE="Read More ..." MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE="Register to read more" -MOD_ARTICLES_CATEGORY_XML_DESCRIPTION="This module displays a list of articles from one or more categories." \ No newline at end of file +MOD_ARTICLES_CATEGORY_XML_DESCRIPTION="This module displays a list of articles from one or more categories." diff --git a/modules/mod_articles_category/helper.php b/modules/mod_articles_category/helper.php index a7c5c14e58d69..6f496013e2fda 100644 --- a/modules/mod_articles_category/helper.php +++ b/modules/mod_articles_category/helper.php @@ -437,12 +437,13 @@ public static function groupBy($list, $fieldName, $article_grouping_direction, $ * @param string $type type of grouping * @param string $article_grouping_direction ordering direction * @param string $month_year_format date format to use + * @param string $field date field to group by * * @return array * * @since 1.6 */ - public static function groupByDate($list, $type = 'year', $article_grouping_direction, $month_year_format = 'F Y') + public static function groupByDate($list, $type = 'year', $article_grouping_direction = 'ksort', $month_year_format = 'F Y', $field = 'created') { $grouped = array(); @@ -461,7 +462,7 @@ public static function groupByDate($list, $type = 'year', $article_grouping_dire switch ($type) { case 'month_year' : - $month_year = StringHelper::substr($item->created, 0, 7); + $month_year = StringHelper::substr($item->$field, 0, 7); if (!isset($grouped[$month_year])) { @@ -473,7 +474,7 @@ public static function groupByDate($list, $type = 'year', $article_grouping_dire case 'year' : default: - $year = StringHelper::substr($item->created, 0, 4); + $year = StringHelper::substr($item->$field, 0, 4); if (!isset($grouped[$year])) { diff --git a/modules/mod_articles_category/mod_articles_category.php b/modules/mod_articles_category/mod_articles_category.php index ed1d05a6c0780..a62d5ab3e5ce0 100644 --- a/modules/mod_articles_category/mod_articles_category.php +++ b/modules/mod_articles_category/mod_articles_category.php @@ -76,7 +76,13 @@ { case 'year' : case 'month_year' : - $list = ModArticlesCategoryHelper::groupByDate($list, $article_grouping, $article_grouping_direction, $params->get('month_year_format', 'F Y')); + $list = ModArticlesCategoryHelper::groupByDate( + $list, + $article_grouping, + $article_grouping_direction, + $params->get('month_year_format', 'F Y'), + $params->get('date_grouping_field', 'created') + ); break; case 'author' : case 'category_title' : diff --git a/modules/mod_articles_category/mod_articles_category.xml b/modules/mod_articles_category/mod_articles_category.xml index 14d32c0851df9..00128b09bf0c0 100644 --- a/modules/mod_articles_category/mod_articles_category.xml +++ b/modules/mod_articles_category/mod_articles_category.xml @@ -344,6 +344,19 @@ + + + + + +