Skip to content

refactor!: replace the data extension points of structure, media pool and media manager with typed classes - #6785

Merged
gharlan merged 1 commit into
6.xfrom
handler
Oct 21, 2026
Merged

gharlan merged 1 commit into
6.xfrom
handler

Conversation

@gharlan

@gharlan gharlan commented Oct 21, 2026

Copy link
Copy Markdown
Member

Second step of the remaining structure/media pool extension point cleanup (after #6784): the extension points carrying data (deletion, permissions, status types, rendering, URLs, queries) become typed classes.

old new subject / carries
ART_PRE_DELETED Content\ExtensionPoint\ArticleDeleting readonly; $article (slices still exist)
ART_IS_PERMITTED Content\ExtensionPoint\ArticlePermissionCheck bool; $article
CAT_IS_PERMITTED Content\ExtensionPoint\CategoryPermissionCheck bool; $category
MEDIA_IS_PERMITTED MediaPool\ExtensionPoint\MediaPermissionCheck bool; $media
ART_STATUS_TYPES, CAT_STATUS_TYPES Content\ExtensionPoint\ArticleStatusTypes list of status types
ART_CONTENT Content\ExtensionPoint\ArticleContentOutput output; $content, $contentSectionId
ART_INIT Content\ExtensionPoint\ArticleContentRendering readonly; $content
ART_SLICES_QUERY Content\ExtensionPoint\ArticleSlicesQuery query; $content
URL_REWRITE Content\ExtensionPoint\ArticleUrl ?string (null = default URL); $articleId, $languageId, $params
MEDIA_URL_REWRITE MediaPool\ExtensionPoint\MediaUrl ?string (null = default URL); $media
MEDIA_LIST_QUERY MediaPool\ExtensionPoint\MediaListQuery query; modifiable $params, $count
MEDIA_MANAGER_URL MediaManager\ExtensionPoint\MediaManagerUrl URL; $type, $fileName, $buster

Status types merged

The status of a category is stored as the status of its start article, yet there were two lists of status types with separate extension points. An addon extending only one of them (accessdenied registers the same listener for both) would let them diverge. Now there is one list: ArticleStatusTypes replaces both points, and CategoryHandler::statusTypes()/nextStatus()/prevStatus() are removed in favor of the ArticleHandler methods (rector rules included).

Further changes

  • ArticleUrl/MediaUrl use null instead of '' for "keep the default URL".
  • MediaListQuery provides the query parameters as a modifiable property instead of a reference in the params, and $count tells the count query of a paginated list apart. As before, the data query already contains ORDER BY/LIMIT when it is dispatched.
  • The history/working version listeners in boot/frontend.php use the typed points; their comments claiming that the article id is unknown in ART_INIT were outdated and are corrected.
  • Media::isPermitted() no longer needs its return.tooWideBool ignore; the psalm baseline shrinks.
  • Rector rules map all old names.

Tests

New MediaHandlerTest::testMediaListQueryCanBeExtended (count and data query, params). Smoke-tested structure page, media pool list/search, content editor and frontend.

@gharlan gharlan added this to the REDAXO 6.0 milestone Oct 21, 2026
… and media manager with typed classes

    ART_PRE_DELETED     -> Content\ExtensionPoint\ArticleDeleting
    ART_IS_PERMITTED    -> Content\ExtensionPoint\ArticlePermissionCheck
    CAT_IS_PERMITTED    -> Content\ExtensionPoint\CategoryPermissionCheck
    MEDIA_IS_PERMITTED  -> MediaPool\ExtensionPoint\MediaPermissionCheck
    ART_STATUS_TYPES    -> Content\ExtensionPoint\ArticleStatusTypes
    CAT_STATUS_TYPES    -> Content\ExtensionPoint\ArticleStatusTypes
    ART_CONTENT         -> Content\ExtensionPoint\ArticleContentOutput
    ART_INIT            -> Content\ExtensionPoint\ArticleContentRendering
    ART_SLICES_QUERY    -> Content\ExtensionPoint\ArticleSlicesQuery
    URL_REWRITE         -> Content\ExtensionPoint\ArticleUrl
    MEDIA_URL_REWRITE   -> MediaPool\ExtensionPoint\MediaUrl
    MEDIA_LIST_QUERY    -> MediaPool\ExtensionPoint\MediaListQuery
    MEDIA_MANAGER_URL   -> MediaManager\ExtensionPoint\MediaManagerUrl

The status of a category is the one of its start article, so there is one list of status types:
`CategoryHandler::statusTypes()`, `nextStatus()` and `prevStatus()` are removed in favor of the `ArticleHandler`
methods, and `ArticleStatusTypes` replaces both former extension points.

`ArticleUrl` and `MediaUrl` have `null` as subject, which keeps the default URL. `MediaListQuery` provides the query
parameters as a modifiable property instead of a reference param, and tells the count query of a paginated list apart.
@gharlan
gharlan merged commit 5a0e7b6 into 6.x Oct 21, 2026
15 checks passed
@gharlan
gharlan deleted the handler branch October 21, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants