BlogListTargetTrait
Link target for a Blog list: articles, news and events are three separate pages (slug 50 / 52 / 54) with three presenters, but the category is shared.
IMPORTANT: a category link must point to the list of the same type as the item or page it
stands on, otherwise an event card ends up in articles. The category parameter is
categoryId (route masks 101/102/104), not category.
Table of Contents
Constants
- BLOG_LIST_ARTICLE : mixed = 'article'
- BLOG_LIST_EVENT : mixed = 'event'
- BLOG_LIST_NEWS : mixed = 'news'
Methods
- blogListParams() : array<string, mixed>
- Link parameters for a list with a category and a preserved region (same rule as in Bazaar): with a region selected the category segment is always explicit (`-` means none), otherwise the region in the URL would shift into the category position. Without a region nothing changes.
- blogListTarget() : array{0: string, 1: int}
- blogListTargetForPage() : array{0: string, 1: int}
- Target by the current page (for components without an item): news are pages 52/53, events 54/55, otherwise articles.
- blogRegionLinks() : array<int, string>
- Links to the list of the same type filtered by the item region (`/clanky/-/<region>`).
Constants
BLOG_LIST_ARTICLE
protected
mixed
BLOG_LIST_ARTICLE
= 'article'
BLOG_LIST_EVENT
protected
mixed
BLOG_LIST_EVENT
= 'event'
BLOG_LIST_NEWS
protected
mixed
BLOG_LIST_NEWS
= 'news'
Methods
blogListParams()
Link parameters for a list with a category and a preserved region (same rule as in Bazaar): with a region selected the category segment is always explicit (`-` means none), otherwise the region in the URL would shift into the category position. Without a region nothing changes.
protected
blogListParams(int $slug, int|null $categoryId, string|int|null $regionId) : array<string, mixed>
Parameters
- $slug : int
- $categoryId : int|null
- $regionId : string|int|null
Return values
array<string, mixed>blogListTarget()
protected
blogListTarget(string $type) : array{0: string, 1: int}
Parameters
- $type : string
-
BLOG_LIST_* by item type
Return values
array{0: string, 1: int} —[link target, page id (route slug)]
blogListTargetForPage()
Target by the current page (for components without an item): news are pages 52/53, events 54/55, otherwise articles.
protected
blogListTargetForPage(object|null $presenter) : array{0: string, 1: int}
Parameters
- $presenter : object|null
Return values
array{0: string, 1: int} —[link target, page id (route slug)]
blogRegionLinks()
Links to the list of the same type filtered by the item region (`/clanky/-/<region>`).
protected
blogRegionLinks(Presenter|null $presenter, string $type, iterable<string|int, BlogContentInterface> $items[, RouterDispatcher|null $dispatcher = null ]) : array<int, string>
An item without a region (or without the region.translations include) is missing from
the result. Region names in the URL are preloaded from already loaded entities (no query
per region).
Parameters
- $presenter : Presenter|null
- $type : string
- $items : iterable<string|int, BlogContentInterface>
-
articles / news / events
- $dispatcher : RouterDispatcher|null = null
Return values
array<int, string> —[item id => URL]