The ContentFilterExtensionPoint extension point is used to define a static filter. This is a multiple extension point: in other words, several implementations of this extension point can be active at the same time.
A static filter must be defined in a plugin.xml file. If you need to create a new plugin file, follow the instructions on the plugin Ametys page.
Sample declaration
Oops!
Copy to clipboard failed. Open the code and copy it manually.
Contains the list of content types searched for Ex: <type id="org.ametys.web.default.Content.article"/>
no
<tags>
Contains a list of labels that must be applied to the content searched for.
The "condition" attribute defines the type of operator (OR or AND) used:
The value AND means that the filter will retrieve content tagged with all the tags mentioned. This is the default value (it will be used if the "condition" attribute is not set).
The OR value means that the filter will retrieve content tagged with at least one of the following labels
The "strict" assignment enables or disables top-down autoposting:
The value true means that the label search is a strict search, i.e. the content retrieved will only be that bearing the exact labels quoted. This is the default value (in the absence of the "strict" attribute).
The value false enables top-down autoposting. The content retrieved will then be content bearing the tags mentioned or one of their child tags.
no
<metadata>
Defines metadata conditions. The "condition" attribute defines the type of operator (OR or AND) used. The "AND" condition is the default. See the "Metadata conditions" paragraph dedicated to this element.
no
<view>
Defines the view used to display content. If not specified, the "main" view is used by default. Most content has the following views available: main (full view), abstract (summary view) and link (link view). Others may exist (see Graphical rendering of content).
no
<context>
Defines the search context:
current-site: the current site
other-sites: all sites except the current site
all-sites: all sites
child-pages: child pages of the current page
no-site: for searches on off-site content, such as directory content
yes
<max-result>
Defines the maximum number of items to be filtered. Unlimited by default.
no
<sort-information>
Determines content sorting order based on metadata Ex: <sort metadataId="publication-date" ascending="true"/>
no
<mask-orphan>
If "true", orphaned content, i.e. content not attached to any page, is hidden. false by default.
no
<handle-user-access>
If "true", the filter takes into account the rights (on restricted pages) of the connected user. false by default.
no
<access-limitation>
Only from Ametys 4.8 If present, the "handle-user-access" configuration is ignored.
3 possible values:
page-access: strictly equivalent to handle-user-acces="false", the filter displays content with the same access rights as the current page (caching possible)
user-access: strictly equivalent to handle-user-acces="true", the filter displays content according to the current user.
anyconnected-access: the filter displays all content accessible to anonymous users or to all connected users. This mode should be used with caution, and only for automatic intranet newsletters.
Metadata requirements
The "metadata" block represents the conditions to be met by content in order to be filtered. Each "metadata" tag in the block indicates a condition on a content metadata.
The "condition" attribute on the "metadata" block represents the operator between the various conditions:
The value AND means that the filter will retrieve content whose metadata meets all the declared conditions. This is the default value (it will be used if the "condition" attribute is not set).
The value OR means that the filter will retrieve content whose metadata meets at least one condition.
Conditions can be simple (equality test on text values) or complex ("greater than", "less than" test on date values).
Simple conditions
A simple condition is an equality test on a textual value. The name of the metadata is indicated in the "id" attribute and the value tested in the tag content. To retrieve content whose "creator" metadata has the value "laurence", we write :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
Complex conditions can be used to represent more advanced tests. To define a complex condition, specify the "type" and "operator" attributes in the "metadata" tag.
The "type" attribute specifies the type of metadata.
The "operator" attribute specifies the condition operator. The possible values depend on the metadata type.
Currently, only complex "date" conditions are supported.
Complex conditions on date-type metadata
Complex date conditions allow you to perform tests such as "the start date is from yesterday" or "the publication is less than 7 days old".
The operators available are :
The "eq" operator to retrieve content whose metadata is equal to the specified date.
The "gte" operator to retrieve content whose metadata is after or equal to the specified date.
The "gt" operator to retrieve content whose metadata is strictly after the specified date.
The "lte" operator to retrieve content whose metadata is before or equal to the specified date.
The "lt" operator to retrieve content whose metadata is strictly before the specified date.
Values can be specified in several ways:
Either "today" or "now" to indicate the current date.
Or a specific day represented in year-month-day format, for example "2013-11-24" for November 24, 2013.
Or a day relative to the current date, represented by a positive number for a number of days after the current date, or a negative number for a number of days before the current date. For example, "-1" represents yesterday and "7" represents "7 days from now".
For example, the following condition block will return content published in the last 7 days.
Oops!
Copy to clipboard failed. Open the code and copy it manually.