primo commit
This commit is contained in:
768
modules/mod_articles/mod_articles.xml
Normal file
768
modules/mod_articles/mod_articles.xml
Normal file
@ -0,0 +1,768 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="site" method="upgrade">
|
||||
<name>MOD_ARTICLES</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2024-07</creationDate>
|
||||
<copyright>(C) 2024 Open Source Matters, Inc.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>5.2.0</version>
|
||||
<description>MOD_ARTICLES_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Articles</namespace>
|
||||
<files>
|
||||
<folder module="mod_articles">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_articles.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_articles.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Articles" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic"
|
||||
addfieldprefix="Joomla\Component\Content\Administrator\Field" >
|
||||
<field
|
||||
name="mode"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_MODE_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_MODE_DESC"
|
||||
default="normal"
|
||||
validate="options"
|
||||
>
|
||||
<option value="normal">MOD_ARTICLES_OPTION_NORMAL_VALUE</option>
|
||||
<option value="dynamic">MOD_ARTICLES_OPTION_DYNAMIC_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_on_article_page"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_SHOWONARTICLEPAGE_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_SHOWONARTICLEPAGE_DESC"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="mode:dynamic"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="count"
|
||||
type="number"
|
||||
label="MOD_ARTICLES_FIELD_COUNT_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_COUNT_DESC"
|
||||
default="5"
|
||||
filter="integer"
|
||||
min="0"
|
||||
validate="number"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="category_filtering_type"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_CATFILTERINGTYPE_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_CATFILTERINGTYPE_DESC"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_OPTION_EXCLUSIVE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_OPTION_INCLUSIVE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
label="JCATEGORY"
|
||||
extension="com_content"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
filter="intarray"
|
||||
class="multipleCategories"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_child_category_articles"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_SHOWCHILDCATEGORYARTICLES_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_SHOWCHILDCATEGORYARTICLES_DESC"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_OPTION_EXCLUDE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_OPTION_INCLUDE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="levels"
|
||||
type="number"
|
||||
label="MOD_ARTICLES_FIELD_CATDEPTH_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="show_child_category_articles:1"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="exclude_current"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_EXCLUDE_CURRENT_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="ex_or_include_articles"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_EX_OR_INCLUDE_LABEL"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_OPTION_EXCLUDE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_OPTION_INCLUDE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="excluded_articles"
|
||||
type="subform"
|
||||
label="MOD_ARTICLES_FIELD_EXCLUDEDARTICLES_LABEL"
|
||||
multiple="true"
|
||||
buttons="add,remove"
|
||||
showon="ex_or_include_articles:0"
|
||||
>
|
||||
<form>
|
||||
<field
|
||||
name="id"
|
||||
type="modal_article"
|
||||
label="MOD_ARTICLES_FIELD_SELECT_ARTICLE_LABEL"
|
||||
select="true"
|
||||
new="false"
|
||||
edit="false"
|
||||
clear="true"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="included_articles"
|
||||
type="subform"
|
||||
label="MOD_ARTICLES_FIELD_INCLUDEDARTICLES_LABEL"
|
||||
multiple="true"
|
||||
buttons="add,remove"
|
||||
showon="ex_or_include_articles:1"
|
||||
>
|
||||
<form>
|
||||
<field
|
||||
name="id"
|
||||
type="modal_article"
|
||||
label="MOD_ARTICLES_FIELD_SELECT_ARTICLE_LABEL"
|
||||
select="true"
|
||||
new="false"
|
||||
edit="false"
|
||||
clear="true"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="display"
|
||||
label="MOD_ARTICLES_FIELD_GROUP_DISPLAY_LABEL"
|
||||
>
|
||||
<field
|
||||
name="title_only"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_TITLEONLY_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="articles_layout"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_LAYOUT_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_LAYOUT_DESC"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_FIELD_LAYOUT_VERT</option>
|
||||
<option value="1">MOD_ARTICLES_FIELD_LAYOUT_HOR</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="layout_columns"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_LAYOUT_COL_LABEL"
|
||||
default="3"
|
||||
filter="integer"
|
||||
showon="title_only:0[AND]articles_layout:1"
|
||||
validate="options"
|
||||
>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="item_title"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_TITLE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="item_heading"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_TITLE_HEADING"
|
||||
default="h4"
|
||||
showon="title_only:0[AND]item_title:1"
|
||||
validate="options"
|
||||
>
|
||||
<option value="h1">JH1</option>
|
||||
<option value="h2">JH2</option>
|
||||
<option value="h3">JH3</option>
|
||||
<option value="h4">JH4</option>
|
||||
<option value="h5">JH5</option>
|
||||
<option value="div">MOD_ARTICLES_FIELD_TITLE_HEADING_NONE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="link_titles"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="MOD_ARTICLES_FIELD_LINKTITLES_LABEL"
|
||||
default="1"
|
||||
showon="title_only:0[AND]item_title:1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_author"
|
||||
type="radio"
|
||||
label="JAUTHOR"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_category"
|
||||
type="radio"
|
||||
label="JCATEGORY"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_category_link"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_SHOWCATEGORYLINK_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0[AND]show_category:1"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_date"
|
||||
type="radio"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
label="JDATE"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_date_field"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_DATEFIELD_LABEL"
|
||||
default="created"
|
||||
showon="title_only:0[AND]show_date:1"
|
||||
validate="options"
|
||||
>
|
||||
<option value="created">MOD_ARTICLES_OPTION_CREATED_VALUE</option>
|
||||
<option value="modified">MOD_ARTICLES_OPTION_MODIFIED_VALUE</option>
|
||||
<option value="publish_up">MOD_ARTICLES_OPTION_STARTPUBLISHING_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_date_format"
|
||||
type="text"
|
||||
label="MOD_ARTICLES_FIELD_DATEFIELDFORMAT_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_DATEFIELDFORMAT_DESC"
|
||||
default="Y-m-d H:i:s"
|
||||
showon="title_only:0[AND]show_date:1"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_hits"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_SHOWHITS_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="info_layout"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_INFOLAYOUT_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_INFOLAYOUT_DESC"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="show_date:1[OR]show_category:1[OR]show_hits:1[OR]show_author:1[AND]title_only:0"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_FIELD_LAYOUT_MULTILINE</option>
|
||||
<option value="1">MOD_ARTICLES_FIELD_LAYOUT_SINGLELINE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_tags"
|
||||
type="radio"
|
||||
label="JTAG"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="trigger_events"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_TRIGGER_EVENTS_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_TRIGGER_EVENTS_DESC"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_introtext"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_SHOWINTROTEXT_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="introtext_limit"
|
||||
type="number"
|
||||
label="MOD_ARTICLES_FIELD_INTROTEXTLIMIT_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_INTROTEXTLIMIT_DESC"
|
||||
default="100"
|
||||
filter="integer"
|
||||
showon="title_only:0[AND]show_introtext:1"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="image"
|
||||
type="radio"
|
||||
label="MOD_ARTICLES_FIELD_IMAGES_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_IMAGES_DESC"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0[AND]introtext_limit:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="img_intro_full"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_IMAGES_ARTICLE_LABEL"
|
||||
default="none"
|
||||
validate="options"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="intro">MOD_ARTICLES_OPTION_INTROIMAGE</option>
|
||||
<option value="full">MOD_ARTICLES_OPTION_FULLIMAGE</option>
|
||||
<option value="none">JNO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_readmore"
|
||||
type="radio"
|
||||
label="JGLOBAL_SHOW_READMORE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
showon="title_only:0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="show_readmore_title"
|
||||
type="radio"
|
||||
label="JGLOBAL_SHOW_READMORE_TITLE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="title_only:0[AND]show_readmore:1"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="readmore_limit"
|
||||
type="number"
|
||||
label="JGLOBAL_SHOW_READMORE_LIMIT_LABEL"
|
||||
default="15"
|
||||
filter="integer"
|
||||
showon="title_only:0[AND]show_readmore:1[AND]show_readmore_title:1"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="filtering"
|
||||
label="MOD_ARTICLES_FIELD_GROUP_FILTERING_LABEL"
|
||||
>
|
||||
<field
|
||||
name="show_featured"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_SHOWFEATURED_LABEL"
|
||||
default="show"
|
||||
validate="options"
|
||||
>
|
||||
<option value="show">JSHOW</option>
|
||||
<option value="hide">JHIDE</option>
|
||||
<option value="only">MOD_ARTICLES_OPTION_ONLYFEATURED_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="filteringspacer1"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="show_archived"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_ONLYARCHIVED_LABEL"
|
||||
default="hide"
|
||||
validate="options"
|
||||
>
|
||||
<option value="show">MOD_ARTICLES_OPTION_ONLYARCHIVEDSHOW_VALUE</option>
|
||||
<option value="hide">MOD_ARTICLES_OPTION_ONLYARCHIVEDHIDE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="filteringspacer2"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filter_tag"
|
||||
type="tag"
|
||||
label="JTAG"
|
||||
mode="nested"
|
||||
multiple="true"
|
||||
filter="intarray"
|
||||
class="multipleTags"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filteringspacer3"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="author_filtering_type"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_AUTHORFILTERING_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_OPTION_EXCLUSIVE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_OPTION_INCLUSIVE_VALUE</option>
|
||||
<option value="2">MOD_ARTICLES_OPTION_ONLYCURRENTUSER_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="created_by"
|
||||
type="author"
|
||||
label="MOD_ARTICLES_FIELD_AUTHOR_LABEL"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
filter="intarray"
|
||||
class="multipleAuthors"
|
||||
showon="author_filtering_type!:2"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filteringspacer4"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="author_alias_filtering_type"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_AUTHORALIASFILTERING_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">MOD_ARTICLES_OPTION_EXCLUSIVE_VALUE</option>
|
||||
<option value="1">MOD_ARTICLES_OPTION_INCLUSIVE_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="created_by_alias"
|
||||
type="sql"
|
||||
label="MOD_ARTICLES_FIELD_AUTHORALIAS_LABEL"
|
||||
multiple="true"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
query="select distinct(created_by_alias) from #__content where created_by_alias != '' order by created_by_alias ASC"
|
||||
key_field="created_by_alias"
|
||||
value_field="created_by_alias"
|
||||
class="multipleAuthorAliases"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="filteringspacer5"
|
||||
type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="date_filtering"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_DATEFILTERING_LABEL"
|
||||
default="off"
|
||||
validate="options"
|
||||
>
|
||||
<option value="off">MOD_ARTICLES_OPTION_OFF_VALUE</option>
|
||||
<option value="range">MOD_ARTICLES_OPTION_DATERANGE_VALUE</option>
|
||||
<option value="relative">MOD_ARTICLES_OPTION_RELATIVEDAY_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="date_field"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_DATERANGEFIELD_LABEL"
|
||||
default="a.created"
|
||||
showon="date_filtering!:off"
|
||||
validate="options"
|
||||
>
|
||||
<option value="a.created">MOD_ARTICLES_OPTION_CREATED_VALUE</option>
|
||||
<option value="a.modified">MOD_ARTICLES_OPTION_MODIFIED_VALUE</option>
|
||||
<option value="a.publish_up">MOD_ARTICLES_OPTION_STARTPUBLISHING_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="start_date_range"
|
||||
type="calendar"
|
||||
label="MOD_ARTICLES_FIELD_STARTDATE_LABEL"
|
||||
translateformat="true"
|
||||
showtime="true"
|
||||
filter="user_utc"
|
||||
showon="date_filtering:range"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="end_date_range"
|
||||
type="calendar"
|
||||
label="MOD_ARTICLES_FIELD_ENDDATE_LABEL"
|
||||
translateformat="true"
|
||||
showtime="true"
|
||||
filter="user_utc"
|
||||
showon="date_filtering:range"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="relative_date"
|
||||
type="number"
|
||||
label="MOD_ARTICLES_FIELD_RELATIVEDATE_LABEL"
|
||||
default="30"
|
||||
filter="integer"
|
||||
showon="date_filtering:relative"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="ordering"
|
||||
label="MOD_ARTICLES_FIELD_GROUP_ORDERING_LABEL"
|
||||
>
|
||||
<field
|
||||
name="article_ordering"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_ARTICLEORDERING_LABEL"
|
||||
default="a.title"
|
||||
validate="options"
|
||||
>
|
||||
<option value="a.ordering">MOD_ARTICLES_OPTION_ORDERING_VALUE</option>
|
||||
<option value="fp.ordering">MOD_ARTICLES_OPTION_ORDERINGFEATURED_VALUE</option>
|
||||
<option value="a.hits" requires="hits">MOD_ARTICLES_OPTION_HITS_VALUE</option>
|
||||
<option value="a.title">JGLOBAL_TITLE</option>
|
||||
<option value="a.id">MOD_ARTICLES_OPTION_ID_VALUE</option>
|
||||
<option value="a.alias">JFIELD_ALIAS_LABEL</option>
|
||||
<option value="a.created">MOD_ARTICLES_OPTION_CREATED_VALUE</option>
|
||||
<option value="modified">MOD_ARTICLES_OPTION_MODIFIED_VALUE</option>
|
||||
<option value="publish_up">MOD_ARTICLES_OPTION_STARTPUBLISHING_VALUE</option>
|
||||
<option value="a.publish_down">MOD_ARTICLES_OPTION_FINISHPUBLISHING_VALUE</option>
|
||||
<option value="random">MOD_ARTICLES_OPTION_RANDOM_VALUE</option>
|
||||
<option value="rating_count" requires="vote">MOD_ARTICLES_OPTION_VOTE_VALUE</option>
|
||||
<option value="rating" requires="vote">MOD_ARTICLES_OPTION_RATING_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="article_ordering_direction"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_ARTICLEORDERINGDIR_LABEL"
|
||||
default="ASC"
|
||||
validate="options"
|
||||
>
|
||||
<option value="DESC">MOD_ARTICLES_OPTION_DESCENDING_VALUE</option>
|
||||
<option value="ASC">MOD_ARTICLES_OPTION_ASCENDING_VALUE</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="grouping"
|
||||
label="MOD_ARTICLES_FIELD_GROUP_GROUPING_LABEL"
|
||||
>
|
||||
<field
|
||||
name="article_grouping"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_ARTICLEGROUPING_LABEL"
|
||||
default="none"
|
||||
validate="options"
|
||||
>
|
||||
<option value="none">JNONE</option>
|
||||
<option value="year">MOD_ARTICLES_OPTION_YEAR_VALUE</option>
|
||||
<option value="month_year">MOD_ARTICLES_OPTION_MONTHYEAR_VALUE</option>
|
||||
<option value="author">JAUTHOR</option>
|
||||
<option value="category_title">JCATEGORY</option>
|
||||
<option value="tags">JTAG</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="date_grouping_field"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_DATEGROUPINGFIELD_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_DATEGROUPINGFIELD_DESC"
|
||||
default="created"
|
||||
showon="article_grouping:year,month_year"
|
||||
validate="options"
|
||||
>
|
||||
<option value="created">MOD_ARTICLES_OPTION_CREATED_VALUE</option>
|
||||
<option value="modified">MOD_ARTICLES_OPTION_MODIFIED_VALUE</option>
|
||||
<option value="publish_up">MOD_ARTICLES_OPTION_STARTPUBLISHING_VALUE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="month_year_format"
|
||||
type="text"
|
||||
label="MOD_ARTICLES_FIELD_MONTHYEARFORMAT_LABEL"
|
||||
description="MOD_ARTICLES_FIELD_MONTHYEARFORMAT_DESC"
|
||||
default="F Y"
|
||||
showon="article_grouping:year,month_year"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="article_grouping_direction"
|
||||
type="list"
|
||||
label="MOD_ARTICLES_FIELD_ARTICLEGROUPINGDIR_LABEL"
|
||||
default="ksort"
|
||||
showon="article_grouping!:none"
|
||||
validate="options"
|
||||
>
|
||||
<option value="krsort">MOD_ARTICLES_OPTION_DESCENDING_VALUE</option>
|
||||
<option value="ksort">MOD_ARTICLES_OPTION_ASCENDING_VALUE</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
class="form-select"
|
||||
validate="moduleLayout"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
rows="3"
|
||||
validate="CssIdentifier"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="owncache"
|
||||
type="list"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
validate="options"
|
||||
>
|
||||
<option value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="cache_time"
|
||||
type="number"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
default="900"
|
||||
filter="integer"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
41
modules/mod_articles/services/provider.php
Normal file
41
modules/mod_articles/services/provider.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles
|
||||
*
|
||||
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\Service\Provider\HelperFactory;
|
||||
use Joomla\CMS\Extension\Service\Provider\Module;
|
||||
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
|
||||
/**
|
||||
* The articles module service provider.
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since __ DEPLOY_VERSION__
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Articles'));
|
||||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Articles\\Site\\Helper'));
|
||||
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
84
modules/mod_articles/src/Dispatcher/Dispatcher.php
Normal file
84
modules/mod_articles/src/Dispatcher/Dispatcher.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles
|
||||
*
|
||||
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Articles\Site\Dispatcher;
|
||||
|
||||
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareInterface;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareTrait;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Dispatcher class for mod_articles
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
|
||||
{
|
||||
use HelperFactoryAwareTrait;
|
||||
|
||||
/**
|
||||
* Returns the layout data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
protected function getLayoutData(): array
|
||||
{
|
||||
$data = parent::getLayoutData();
|
||||
$params = $data['params'];
|
||||
|
||||
// Prep for Normal or Dynamic Modes
|
||||
$mode = $params->get('mode', 'normal');
|
||||
$idBase = null;
|
||||
|
||||
switch ($mode) {
|
||||
case 'dynamic':
|
||||
$option = $data['input']->get('option');
|
||||
$view = $data['input']->get('view');
|
||||
|
||||
if ($option === 'com_content') {
|
||||
switch ($view) {
|
||||
case 'category':
|
||||
case 'categories':
|
||||
$idBase = $data['input']->getInt('id');
|
||||
break;
|
||||
case 'article':
|
||||
if ($params->get('show_on_article_page', 1)) {
|
||||
$idBase = $data['input']->getInt('catid');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$idBase = $params->get('catid');
|
||||
break;
|
||||
}
|
||||
|
||||
$cacheParams = new \stdClass();
|
||||
$cacheParams->cachemode = 'id';
|
||||
$cacheParams->class = $this->getHelperFactory()->getHelper('ArticlesHelper');
|
||||
$cacheParams->method = 'getArticles';
|
||||
$cacheParams->methodparams = [$params, $data['app']];
|
||||
$cacheParams->modeparams = md5(serialize([$idBase, $this->module->module, $this->module->id]));
|
||||
|
||||
$data['list'] = ModuleHelper::moduleCache($this->module, $params, $cacheParams);
|
||||
|
||||
$data['grouped'] = $params->get('article_grouping', 'none') !== 'none';
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
589
modules/mod_articles/src/Helper/ArticlesHelper.php
Normal file
589
modules/mod_articles/src/Helper/ArticlesHelper.php
Normal file
@ -0,0 +1,589 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles
|
||||
*
|
||||
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Articles\Site\Helper;
|
||||
|
||||
use Joomla\CMS\Access\Access;
|
||||
use Joomla\CMS\Application\SiteApplication;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Date\Date;
|
||||
use Joomla\CMS\Event\Content;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Content\Administrator\Extension\ContentComponent;
|
||||
use Joomla\Component\Content\Site\Helper\RouteHelper;
|
||||
use Joomla\Database\DatabaseAwareInterface;
|
||||
use Joomla\Database\DatabaseAwareTrait;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_articles
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
class ArticlesHelper implements DatabaseAwareInterface
|
||||
{
|
||||
use DatabaseAwareTrait;
|
||||
|
||||
/**
|
||||
* Retrieve a list of articles
|
||||
*
|
||||
* @param Registry $params The module parameters.
|
||||
* @param SiteApplication $app The current application.
|
||||
*
|
||||
* @return object[]
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
public function getArticles(Registry $params, SiteApplication $app)
|
||||
{
|
||||
$factory = $app->bootComponent('com_content')->getMVCFactory();
|
||||
|
||||
// Get an instance of the generic articles model
|
||||
$articles = $factory->createModel('Articles', 'Site', ['ignore_request' => true]);
|
||||
|
||||
// Set application parameters in model
|
||||
$input = $app->getInput();
|
||||
$appParams = $app->getParams();
|
||||
$articles->setState('params', $appParams);
|
||||
|
||||
$articles->setState('list.start', 0);
|
||||
$articles->setState('filter.published', ContentComponent::CONDITION_PUBLISHED);
|
||||
|
||||
// Set the filters based on the module params
|
||||
$articles->setState('list.limit', (int) $params->get('count', 0));
|
||||
$articles->setState('load_tags', $params->get('show_tags', 0) || $params->get('article_grouping', 'none') === 'tags');
|
||||
|
||||
// Get the user object
|
||||
$user = $app->getIdentity();
|
||||
|
||||
// Access filter
|
||||
$access = !ComponentHelper::getParams('com_content')->get('show_noauth');
|
||||
$authorised = Access::getAuthorisedViewLevels($user->id);
|
||||
$articles->setState('filter.access', $access);
|
||||
|
||||
// Prep for Normal or Dynamic Modes
|
||||
$mode = $params->get('mode', 'normal');
|
||||
|
||||
switch ($mode) {
|
||||
case 'dynamic':
|
||||
$option = $input->get('option');
|
||||
$view = $input->get('view');
|
||||
|
||||
if ($option === 'com_content') {
|
||||
switch ($view) {
|
||||
case 'category':
|
||||
case 'categories':
|
||||
$catids = [$input->getInt('id')];
|
||||
break;
|
||||
case 'article':
|
||||
if ($params->get('show_on_article_page', 1)) {
|
||||
$article_id = $input->getInt('id');
|
||||
$catid = $input->getInt('catid');
|
||||
|
||||
if (!$catid) {
|
||||
// Get an instance of the generic article model
|
||||
$article = $factory->createModel('Article', 'Site', ['ignore_request' => true]);
|
||||
|
||||
$article->setState('params', $appParams);
|
||||
$article->setState('filter.published', 1);
|
||||
$article->setState('article.id', (int) $article_id);
|
||||
$item = $article->getItem();
|
||||
$catids = [$item->catid];
|
||||
} else {
|
||||
$catids = [$catid];
|
||||
}
|
||||
} else {
|
||||
// Return right away if show_on_article_page option is off
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Return right away if not on the category or article views
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Return right away if not on a com_content page
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$catids = $params->get('catid');
|
||||
$articles->setState('filter.category_id.include', (bool) $params->get('category_filtering_type', 1));
|
||||
break;
|
||||
}
|
||||
|
||||
// Category filter
|
||||
if ($catids) {
|
||||
if ($params->get('show_child_category_articles', 0) && (int) $params->get('levels', 0) > 0) {
|
||||
// Get an instance of the generic categories model
|
||||
$categories = $factory->createModel('Categories', 'Site', ['ignore_request' => true]);
|
||||
$categories->setState('params', $appParams);
|
||||
$levels = $params->get('levels', 1) ?: 9999;
|
||||
$categories->setState('filter.get_children', $levels);
|
||||
$categories->setState('filter.published', 1);
|
||||
$categories->setState('filter.access', $access);
|
||||
$additional_catids = [];
|
||||
|
||||
foreach ($catids as $catid) {
|
||||
$categories->setState('filter.parentId', $catid);
|
||||
$recursive = true;
|
||||
$items = $categories->getItems($recursive);
|
||||
|
||||
if ($items) {
|
||||
foreach ($items as $category) {
|
||||
$condition = (($category->level - $categories->getParent()->level) <= $levels);
|
||||
|
||||
if ($condition) {
|
||||
$additional_catids[] = $category->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$catids = array_unique(array_merge($catids, $additional_catids));
|
||||
}
|
||||
|
||||
$articles->setState('filter.category_id', $catids);
|
||||
}
|
||||
|
||||
// Ordering
|
||||
$ordering = $params->get('article_ordering', 'a.ordering');
|
||||
|
||||
switch ($ordering) {
|
||||
case 'random':
|
||||
$articles->setState('list.ordering', $this->getDatabase()->getQuery(true)->rand());
|
||||
break;
|
||||
|
||||
case 'rating_count':
|
||||
case 'rating':
|
||||
$articles->setState('list.ordering', $ordering);
|
||||
$articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
|
||||
|
||||
if (!PluginHelper::isEnabled('content', 'vote')) {
|
||||
$articles->setState('list.ordering', 'a.ordering');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$articles->setState('list.ordering', $ordering);
|
||||
$articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
|
||||
break;
|
||||
}
|
||||
|
||||
// Filter by multiple tags
|
||||
$articles->setState('filter.tag', $params->get('filter_tag', []));
|
||||
|
||||
// Filter by featured
|
||||
$articles->setState('filter.featured', $params->get('show_featured', 'show'));
|
||||
|
||||
// Filter by author
|
||||
if ($params->get('author_filtering_type', 1) === 2) {
|
||||
$articles->setState('filter.author_id', [$user->id]);
|
||||
} else {
|
||||
$articles->setState('filter.author_id', $params->get('created_by', []));
|
||||
$articles->setState('filter.author_id.include', $params->get('author_filtering_type', 1));
|
||||
}
|
||||
|
||||
$articles->setState('filter.author_alias', $params->get('created_by_alias', []));
|
||||
$articles->setState('filter.author_alias.include', $params->get('author_alias_filtering_type', 1));
|
||||
|
||||
// Filter archived articles
|
||||
if ($params->get('show_archived', 'hide') === 'show') {
|
||||
$articles->setState('filter.published', ContentComponent::CONDITION_ARCHIVED);
|
||||
}
|
||||
|
||||
// Check if we include or exclude articles and process data
|
||||
$ex_or_include_articles = $params->get('ex_or_include_articles', 0);
|
||||
$filterInclude = true;
|
||||
$articlesList = [];
|
||||
$currentArticleId = $input->get('id', 0, 'UINT');
|
||||
|
||||
$isArticleAndShouldExcluded = $params->get('exclude_current', 1) === 1
|
||||
&& $input->get('option') === 'com_content'
|
||||
&& $input->get('view') === 'article';
|
||||
|
||||
$articlesListToProcess = $params->get('included_articles', '');
|
||||
|
||||
if ($ex_or_include_articles === 0) {
|
||||
$filterInclude = false;
|
||||
|
||||
if ($isArticleAndShouldExcluded) {
|
||||
$articlesList[] = $currentArticleId;
|
||||
}
|
||||
|
||||
$articlesListToProcess = $params->get('excluded_articles', '');
|
||||
}
|
||||
|
||||
foreach (ArrayHelper::fromObject($articlesListToProcess) as $article) {
|
||||
if (
|
||||
$ex_or_include_articles === 1
|
||||
&& $isArticleAndShouldExcluded
|
||||
&& (int) $article['id'] === $currentArticleId
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$articlesList[] = (int) $article['id'];
|
||||
}
|
||||
|
||||
// Edge case when the user select include mode but didn't add an article,
|
||||
// we might have to exclude the current article
|
||||
if (
|
||||
$ex_or_include_articles === 1
|
||||
&& $isArticleAndShouldExcluded
|
||||
&& empty($articlesList)
|
||||
) {
|
||||
$filterInclude = false;
|
||||
$articlesList[] = $currentArticleId;
|
||||
}
|
||||
|
||||
if (!empty($articlesList)) {
|
||||
$articles->setState('filter.article_id', $articlesList);
|
||||
$articles->setState('filter.article_id.include', $filterInclude);
|
||||
}
|
||||
|
||||
$date_filtering = $params->get('date_filtering', 'off');
|
||||
|
||||
if ($date_filtering !== 'off') {
|
||||
$articles->setState('filter.date_filtering', $date_filtering);
|
||||
$articles->setState('filter.date_field', $params->get('date_field', 'a.created'));
|
||||
$articles->setState('filter.start_date_range', $params->get('start_date_range', '1000-01-01 00:00:00'));
|
||||
$articles->setState('filter.end_date_range', $params->get('end_date_range', '9999-12-31 23:59:59'));
|
||||
$articles->setState('filter.relative_date', $params->get('relative_date', 30));
|
||||
}
|
||||
|
||||
// Filter by language
|
||||
$articles->setState('filter.language', $app->getLanguageFilter());
|
||||
|
||||
$items = $articles->getItems();
|
||||
|
||||
// Display options
|
||||
$show_date = $params->get('show_date', 0);
|
||||
$show_date_field = $params->get('show_date_field', 'created');
|
||||
$show_date_format = $params->get('show_date_format', 'Y-m-d H:i:s');
|
||||
$show_category = $params->get('show_category', 0);
|
||||
$show_category_link = $params->get('show_category_link', 0);
|
||||
$show_hits = $params->get('show_hits', 0);
|
||||
$show_author = $params->get('show_author', 0);
|
||||
$show_introtext = $params->get('show_introtext', 0);
|
||||
$introtext_limit = $params->get('introtext_limit', 100);
|
||||
|
||||
// Find current Article ID if on an article page
|
||||
$option = $input->get('option');
|
||||
$view = $input->get('view');
|
||||
|
||||
if ($option === 'com_content' && $view === 'article') {
|
||||
$active_article_id = $input->getInt('id');
|
||||
} else {
|
||||
$active_article_id = 0;
|
||||
}
|
||||
|
||||
// Prepare data for display using display options
|
||||
foreach ($items as &$item) {
|
||||
$item->slug = $item->id . ':' . $item->alias;
|
||||
|
||||
$articleLink = Route::_(RouteHelper::getArticleRoute($item->slug, $item->catid, $item->language));
|
||||
|
||||
if ($access || \in_array($item->access, $authorised)) {
|
||||
// We know that user has the privilege to view the article
|
||||
$item->link = $articleLink;
|
||||
} else {
|
||||
$menu = $app->getMenu();
|
||||
$menuitems = $menu->getItems('link', 'index.php?option=com_users&view=login');
|
||||
|
||||
if (isset($menuitems[0])) {
|
||||
$Itemid = $menuitems[0]->id;
|
||||
} elseif ($input->getInt('Itemid') > 0) {
|
||||
// Use Itemid from requesting page only if there is no existing menu
|
||||
$Itemid = $input->getInt('Itemid');
|
||||
}
|
||||
|
||||
$return = base64_encode($articleLink);
|
||||
|
||||
$item->link = Route::_('index.php?option=com_users&view=login&Itemid=' . $Itemid . '&return=' . $return);
|
||||
}
|
||||
|
||||
$item->event = new \stdClass();
|
||||
|
||||
// Check if we should trigger additional plugin events
|
||||
if ($params->get('trigger_events', 0)) {
|
||||
$dispatcher = Factory::getApplication()->getDispatcher();
|
||||
|
||||
// Process the content plugins.
|
||||
PluginHelper::importPlugin('content', null, true, $dispatcher);
|
||||
|
||||
$contentEventArguments = [
|
||||
'context' => 'com_content.article',
|
||||
'subject' => $item,
|
||||
'params' => $item->params,
|
||||
];
|
||||
|
||||
// Extra content from events
|
||||
|
||||
$contentEvents = [
|
||||
'afterDisplayTitle' => new Content\AfterTitleEvent('onContentAfterTitle', $contentEventArguments),
|
||||
'beforeDisplayContent' => new Content\BeforeDisplayEvent('onContentBeforeDisplay', $contentEventArguments),
|
||||
'afterDisplayContent' => new Content\AfterDisplayEvent('onContentAfterDisplay', $contentEventArguments),
|
||||
];
|
||||
|
||||
foreach ($contentEvents as $resultKey => $event) {
|
||||
$results = $dispatcher->dispatch($event->getName(), $event)->getArgument('result', []);
|
||||
|
||||
$item->event->{$resultKey} = $results ? trim(implode("\n", $results)) : '';
|
||||
}
|
||||
} else {
|
||||
$item->event->afterDisplayTitle = '';
|
||||
$item->event->beforeDisplayContent = '';
|
||||
$item->event->afterDisplayContent = '';
|
||||
}
|
||||
|
||||
// Used for styling the active article
|
||||
$item->active = $item->id == $active_article_id ? 'active' : '';
|
||||
|
||||
if ($show_date) {
|
||||
$item->displayDate = HTMLHelper::_('date', $item->$show_date_field, $show_date_format);
|
||||
}
|
||||
|
||||
if ($show_category) {
|
||||
$item->displayCategoryTitle = $item->category_title;
|
||||
}
|
||||
|
||||
if ($show_category_link) {
|
||||
$item->displayCategoryLink = Route::_(RouteHelper::getCategoryRoute($item->catid, $item->category_language));
|
||||
}
|
||||
|
||||
$item->displayAuthorName = $show_author ? $item->author : '';
|
||||
$item->displayCategoryTitle = $show_category ? $item->category_title : '';
|
||||
$item->displayCategoryLink = $show_category_link ? $item->displayCategoryLink : '';
|
||||
$item->displayDate = $show_date ? $item->displayDate : '';
|
||||
$item->displayHits = $show_hits ? $item->hits : '';
|
||||
|
||||
if ($show_introtext) {
|
||||
$item->displayIntrotext = HTMLHelper::_('content.prepare', $item->introtext, '', 'mod_articles.content');
|
||||
|
||||
// Remove any images belongs to the text
|
||||
if (!$params->get('image')) {
|
||||
$item->displayIntrotext = preg_replace('/<img[^>]*>/', '', $item->displayIntrotext);
|
||||
}
|
||||
|
||||
if ($introtext_limit != 0) {
|
||||
$item->displayIntrotext = HTMLHelper::_('string.truncateComplex', $item->displayIntrotext, $introtext_limit);
|
||||
}
|
||||
}
|
||||
|
||||
// Show the Intro/Full image field of the article
|
||||
if ($params->get('img_intro_full') !== 'none') {
|
||||
$images = (new Registry($item->images))->toObject();
|
||||
$item->imageSrc = '';
|
||||
|
||||
if ($params->get('img_intro_full') === 'intro' && !empty($images->image_intro)) {
|
||||
$item->imageSrc = htmlspecialchars($images->image_intro, ENT_COMPAT, 'UTF-8');
|
||||
$images->float_intro = 'mod-articles-image';
|
||||
} elseif ($params->get('img_intro_full') === 'full' && !empty($images->image_fulltext)) {
|
||||
$item->imageSrc = htmlspecialchars($images->image_fulltext, ENT_COMPAT, 'UTF-8');
|
||||
$images->float_fulltext = 'mod-articles-image';
|
||||
}
|
||||
|
||||
$item->images = json_encode($images);
|
||||
}
|
||||
|
||||
$item->displayReadmore = $item->alternative_readmore;
|
||||
}
|
||||
|
||||
// Check if items need be grouped
|
||||
$article_grouping = $params->get('article_grouping', 'none');
|
||||
$article_grouping_direction = $params->get('article_grouping_direction', 'ksort');
|
||||
$grouped = $article_grouping !== 'none';
|
||||
|
||||
if ($items && $grouped) {
|
||||
switch ($article_grouping) {
|
||||
case 'year':
|
||||
case 'month_year':
|
||||
$items = ArticlesHelper::groupByDate(
|
||||
$items,
|
||||
$article_grouping_direction,
|
||||
$article_grouping,
|
||||
$params->get('month_year_format', 'F Y'),
|
||||
$params->get('date_grouping_field', 'created')
|
||||
);
|
||||
break;
|
||||
case 'author':
|
||||
case 'category_title':
|
||||
$items = ArticlesHelper::groupBy($items, $article_grouping, $article_grouping_direction);
|
||||
break;
|
||||
case 'tags':
|
||||
$items = ArticlesHelper::groupByTags($items, $article_grouping_direction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups items by field
|
||||
*
|
||||
* @param array $list list of items
|
||||
* @param string $fieldName name of field that is used for grouping
|
||||
* @param string $direction ordering direction
|
||||
* @param null $fieldNameToKeep field name to keep
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
public static function groupBy($list, $fieldName, $direction, $fieldNameToKeep = null)
|
||||
{
|
||||
$grouped = [];
|
||||
|
||||
if (!\is_array($list)) {
|
||||
if ($list === '') {
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
$list = [$list];
|
||||
}
|
||||
|
||||
foreach ($list as $key => $item) {
|
||||
if (!isset($grouped[$item->$fieldName])) {
|
||||
$grouped[$item->$fieldName] = [];
|
||||
}
|
||||
|
||||
if ($fieldNameToKeep === null) {
|
||||
$grouped[$item->$fieldName][$key] = $item;
|
||||
} else {
|
||||
$grouped[$item->$fieldName][$key] = $item->$fieldNameToKeep;
|
||||
}
|
||||
|
||||
unset($list[$key]);
|
||||
}
|
||||
|
||||
$direction($grouped);
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups items by date
|
||||
*
|
||||
* @param array $list list of items
|
||||
* @param string $direction ordering direction
|
||||
* @param string $type type of grouping
|
||||
* @param string $monthYearFormat date format to use
|
||||
* @param string $field date field to group by
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
public static function groupByDate($list, $direction = 'ksort', $type = 'year', $monthYearFormat = 'F Y', $field = 'created')
|
||||
{
|
||||
$grouped = [];
|
||||
|
||||
if (!\is_array($list)) {
|
||||
if ($list === '') {
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
$list = [$list];
|
||||
}
|
||||
|
||||
foreach ($list as $key => $item) {
|
||||
switch ($type) {
|
||||
case 'month_year':
|
||||
$month_year = StringHelper::substr($item->$field, 0, 7);
|
||||
|
||||
if (!isset($grouped[$month_year])) {
|
||||
$grouped[$month_year] = [];
|
||||
}
|
||||
|
||||
$grouped[$month_year][$key] = $item;
|
||||
break;
|
||||
|
||||
default:
|
||||
$year = StringHelper::substr($item->$field, 0, 4);
|
||||
|
||||
if (!isset($grouped[$year])) {
|
||||
$grouped[$year] = [];
|
||||
}
|
||||
|
||||
$grouped[$year][$key] = $item;
|
||||
break;
|
||||
}
|
||||
|
||||
unset($list[$key]);
|
||||
}
|
||||
|
||||
$direction($grouped);
|
||||
|
||||
if ($type === 'month_year') {
|
||||
foreach ($grouped as $group => $items) {
|
||||
$date = new Date($group);
|
||||
$formatted_group = $date->format($monthYearFormat);
|
||||
$grouped[$formatted_group] = $items;
|
||||
|
||||
unset($grouped[$group]);
|
||||
}
|
||||
}
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Groups items by tags
|
||||
*
|
||||
* @param array $list list of items
|
||||
* @param string $direction ordering direction
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 5.2.0
|
||||
*/
|
||||
public static function groupByTags($list, $direction = 'ksort')
|
||||
{
|
||||
$grouped = [];
|
||||
$untagged = [];
|
||||
|
||||
if (!$list) {
|
||||
return $grouped;
|
||||
}
|
||||
|
||||
foreach ($list as $item) {
|
||||
if ($item->tags->itemTags) {
|
||||
foreach ($item->tags->itemTags as $tag) {
|
||||
$grouped[$tag->title][] = $item;
|
||||
}
|
||||
} else {
|
||||
$untagged[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
$direction($grouped);
|
||||
|
||||
if ($untagged) {
|
||||
$grouped['MOD_ARTICLES_UNTAGGED'] = $untagged;
|
||||
}
|
||||
|
||||
return $grouped;
|
||||
}
|
||||
}
|
||||
49
modules/mod_articles/tmpl/default.php
Normal file
49
modules/mod_articles/tmpl/default.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles
|
||||
*
|
||||
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $app->getDocument()->getWebAssetManager();
|
||||
$wa->registerAndUseStyle('mod_articles', 'mod_articles/mod-articles.css');
|
||||
|
||||
if (!$list) {
|
||||
return;
|
||||
}
|
||||
|
||||
$groupHeading = 'h4';
|
||||
|
||||
if ((bool) $module->showtitle) {
|
||||
$modTitle = $params->get('header_tag');
|
||||
|
||||
if ($modTitle == 'h1') {
|
||||
$groupHeading = 'h2';
|
||||
} elseif ($modTitle == 'h2') {
|
||||
$groupHeading = 'h3';
|
||||
}
|
||||
}
|
||||
|
||||
$layoutSuffix = $params->get('title_only', 0) ? '_titles' : '_items';
|
||||
|
||||
?>
|
||||
<?php if ($grouped) : ?>
|
||||
<?php foreach ($list as $groupName => $items) : ?>
|
||||
<div class="mod-articles-group">
|
||||
<<?php echo $groupHeading; ?>><?php echo Text::_($groupName); ?></<?php echo $groupHeading; ?>>
|
||||
<?php require ModuleHelper::getLayoutPath('mod_articles', $params->get('layout', 'default') . $layoutSuffix); ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<?php $items = $list; ?>
|
||||
<?php require ModuleHelper::getLayoutPath('mod_articles', $params->get('layout', 'default') . $layoutSuffix); ?>
|
||||
<?php endif;
|
||||
124
modules/mod_articles/tmpl/default_items.php
Normal file
124
modules/mod_articles/tmpl/default_items.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles
|
||||
*
|
||||
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
if ($params->get('articles_layout') == 1) {
|
||||
$gridCols = 'grid-cols-' . $params->get('layout_columns');
|
||||
}
|
||||
|
||||
?>
|
||||
<ul class="mod-articles-items<?php echo ($params->get('articles_layout') == 1 ? ' mod-articles-grid ' . $gridCols : ''); ?> mod-list">
|
||||
<?php foreach ($items as $item) : ?>
|
||||
<?php
|
||||
$displayInfo = $item->displayHits || $item->displayAuthorName || $item->displayCategoryTitle || $item->displayDate;
|
||||
?>
|
||||
<li>
|
||||
<article class="mod-articles-item" itemscope itemtype="https://schema.org/Article">
|
||||
|
||||
<?php if ($params->get('item_title') || $displayInfo || $params->get('show_tags') || $params->get('show_introtext') || $params->get('show_readmore')) : ?>
|
||||
<div class="mod-articles-item-content">
|
||||
|
||||
<?php if ($params->get('item_title')) : ?>
|
||||
<?php $item_heading = $params->get('item_heading', 'h4'); ?>
|
||||
<<?php echo $item_heading; ?> class="mod-articles-title" itemprop="name">
|
||||
<?php if ($params->get('link_titles') == 1) : ?>
|
||||
<?php $attributes = ['class' => 'mod-articles-link ' . $item->active, 'itemprop' => 'url']; ?>
|
||||
<?php $link = htmlspecialchars($item->link, ENT_COMPAT, 'UTF-8', false); ?>
|
||||
<?php $title = htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8', false); ?>
|
||||
<?php echo HTMLHelper::_('link', $link, $title, $attributes); ?>
|
||||
<?php else : ?>
|
||||
<?php echo $item->title; ?>
|
||||
<?php endif; ?>
|
||||
</<?php echo $item_heading; ?>>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $item->event->afterDisplayTitle; ?>
|
||||
|
||||
<?php if ($displayInfo) : ?>
|
||||
<?php $listClass = ($params->get('info_layout') == 1) ? 'list-inline' : 'list-unstyled'; ?>
|
||||
<dl class="<?php echo $listClass; ?>">
|
||||
<dt class="article-info-term">
|
||||
<span class="visually-hidden">
|
||||
<?php echo Text::_('MOD_ARTICLES_INFO'); ?>
|
||||
</span>
|
||||
</dt>
|
||||
|
||||
<?php if ($item->displayAuthorName) : ?>
|
||||
<dd class="mod-articles-writtenby <?php echo ($params->get('info_layout') == 1 ? 'list-inline-item' : ''); ?>">
|
||||
<?php echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'icon-user icon-fw']); ?>
|
||||
<?php echo $item->displayAuthorName; ?>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($item->displayCategoryTitle) : ?>
|
||||
<dd class="mod-articles-category <?php echo ($params->get('info_layout') == 1 ? 'list-inline-item' : ''); ?>">
|
||||
<?php echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'icon-folder-open icon-fw']); ?>
|
||||
<?php if ($item->displayCategoryLink) : ?>
|
||||
<a href="<?php echo $item->displayCategoryLink; ?>">
|
||||
<?php echo $item->displayCategoryTitle; ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php echo $item->displayCategoryTitle; ?>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($item->displayDate) : ?>
|
||||
<dd class="mod-articles-date <?php echo ($params->get('info_layout') == 1 ? 'list-inline-item' : ''); ?>">
|
||||
<?php echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'icon-calendar icon-fw']); ?>
|
||||
<?php echo $item->displayDate; ?>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($item->displayHits) : ?>
|
||||
<dd class="mod-articles-hits <?php echo ($params->get('info_layout') == 1 ? 'list-inline-item' : ''); ?>">
|
||||
<?php echo LayoutHelper::render('joomla.icon.iconclass', ['icon' => 'icon-eye icon-fw']); ?>
|
||||
<?php echo $item->displayHits; ?>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
</dl>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (in_array($params->get('img_intro_full'), ['intro', 'full']) && !empty($item->imageSrc)) : ?>
|
||||
<?php echo LayoutHelper::render('joomla.content.' . $params->get('img_intro_full') . '_image', $item); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('show_tags', 0) && $item->tags->itemTags) : ?>
|
||||
<div class="mod-articles-tags">
|
||||
<?php echo LayoutHelper::render('joomla.content.tags', $item->tags->itemTags); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $item->event->beforeDisplayContent; ?>
|
||||
|
||||
<?php if ($params->get('show_introtext', 1)) : ?>
|
||||
<?php echo $item->displayIntrotext; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $item->event->afterDisplayContent; ?>
|
||||
|
||||
<?php if ($params->get('show_readmore')) : ?>
|
||||
<?php if ($params->get('show_readmore_title', '') !== '') : ?>
|
||||
<?php $item->params->set('show_readmore_title', $params->get('show_readmore_title')); ?>
|
||||
<?php $item->params->set('readmore_limit', $params->get('readmore_limit')); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo LayoutHelper::render('joomla.content.readmore', ['item' => $item, 'params' => $item->params, 'link' => $item->link]); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
24
modules/mod_articles/tmpl/default_titles.php
Normal file
24
modules/mod_articles/tmpl/default_titles.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Site
|
||||
* @subpackage mod_articles
|
||||
*
|
||||
* @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
<ul class="mod-articles mod-list">
|
||||
<?php foreach ($items as $item) : ?>
|
||||
<li itemscope itemtype="https://schema.org/Article">
|
||||
<a <?php echo $item->active ? 'class="' . $item->active . '" ' : ''; ?>href="<?php echo $item->link; ?>" itemprop="url">
|
||||
<span itemprop="name">
|
||||
<?php echo $item->title; ?>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
Reference in New Issue
Block a user