diff --git a/api/extensions/hooks/README.md b/api/extensions/hooks/README.md index 495ada62e..13eece5f3 100644 --- a/api/extensions/hooks/README.md +++ b/api/extensions/hooks/README.md @@ -61,8 +61,8 @@ custom functionality to the core. - [loadFormField](loadFormField.md) - [loadLanguageFile](loadLanguageFile.md) - [modifyFrontendPage](modifyFrontendPage.md) -- newsListCountItems -- newsListFetchItems +- [newsListCountItems](newsListCountItems.md) +- [newsListFetchItems](newsListFetchItems.md) - [outputBackendTemplate](outputBackendTemplate.md) - [outputFrontendTemplate](outputFrontendTemplate.md) - [parseArticles](parseArticles.md) diff --git a/api/extensions/hooks/newsListCountItems.md b/api/extensions/hooks/newsListCountItems.md new file mode 100644 index 000000000..a4b30bd5a --- /dev/null +++ b/api/extensions/hooks/newsListCountItems.md @@ -0,0 +1,62 @@ +# newsListCountItems + +The `newsListCountItems` hook is triggered when the number of news items is +needed (before fetching a news list). + +> #### primary:: Available +> from Contao 3.5.0. + + +## Parameters + +1. *array* `$newsArchives` + + An array containing news archives IDs. + +2. *boolean* `$blnFeatured` + + A boolean that indicates if the news list must display featured news. + Possible values are: + - `null` (display all news) + - `true` (display only featured news) + - `false` (display all news that are not featured) + +3. *ModuleNewsList* `$newsListModule` + + The news list module that was used to fetch items. + + +## Return Values +Return an `integer`, `null` or `false`. If you return an integer, this news +list count will be used in the module. If you return `false`, other +`newsListCountItems` modules will be called. And if you return `null`, the +default news list count will be used in the module. + +## Example + +```php + #### primary:: Available +> from Contao 3.5.0. + + +## Parameters + +1. *array* `$newsArchives` + + An array containing news archives IDs. + +2. *boolean* `$blnFeatured` + + A boolean that indicates if the news list must display featured news. + Possible values are: + - `null` (display all news) + - `true` (display only featured news) + - `false` (display all news that are not featured) + +3. *int* `$limit` + + Number of items that should be displayed. + +4. *int* `$offset` + + Offset of items to skip. + +5. *ModuleNewsList* `$newsListModule` + + The news list module that was used to fetch items. + + +## Return Values +Return a news collection (`\Model\Collection`), `null` or `false`. If you +return a collection, this collection will be used in the news list module. If +you return `false`, other `newsListFetchItems` modules will be called. And if +you return `null`, the default news list items will be used in the module. + + +## Example + +```php +