Skip to content

refactor!: register addon backend pages via Addon::getPages()#6529

Merged
gharlan merged 3 commits into
6.xfrom
refactor/addon-getpages
May 31, 2026
Merged

refactor!: register addon backend pages via Addon::getPages()#6529
gharlan merged 3 commits into
6.xfrom
refactor/addon-getpages

Conversation

@gharlan
Copy link
Copy Markdown
Member

@gharlan gharlan commented May 31, 2026

Summary

Replaces the package.yml page/pages configuration with an overridable Addon::getPages() method that returns Page objects — the last functional bit of package.yml besides default_config.

public function getPages(): iterable
{
    yield new MainPage('addons', $this->name, I18n::msg('my_title'))
        ->setIcon('rex-icon rex-icon-myaddon')
        ->addSubpage(new Page('settings', I18n::msg('settings')));
}

Details

  • Path-by-convention preserved: a page without an explicit path falls back to pages/<key>.php, or pages/index.php for the main page whose key equals the addon name. Subpaths keep the dotted-prefix scheme.
  • live_mode filtering is now explicit PHP (if (Core::isLiveMode()) return;) instead of a YAML flag.
  • Cross-tree insertion: the deferred foo/bar key-matching mechanism is dropped. getPages() runs in load order after the core pages, so Controller::getPageObject() can attach subpages to core/earlier-loading addons; later-loading targets use LoadOrder::Late or the PAGES_PREPARED extension point.
  • Top-level pages are typically MainPage (shown in navigation); a plain Page remains valid for hidden, key/URL-reachable entry points (same as core's profile/credits).
  • The debug addon is converted and its package.yml removed; the package.yml schema is reduced to default_config.

Net −314 lines. The array-parsing helpers (pageCreate, pageAddProperties) are gone.

Compatibility

Breaking change for addons that defined pages in package.yml — they move to Addon::getPages(). Acceptable on 6.x (no stable release yet).

Replace the package.yml `page`/`pages` configuration with an overridable
`Addon::getPages()` method returning Page objects. The path-by-convention
behavior (pages/index.php for the main page, pages/<key>.php for others) is
preserved; live_mode filtering and cross-tree insertion become explicit PHP
instead of magic keys. Drops the deferred `foo/bar` insert mechanism in favor
of load order + getPageObject() or the PAGES_PREPARED extension point.

The debug addon is converted accordingly and its package.yml removed. The
package.yml schema is reduced to default_config.
@gharlan gharlan added this to the REDAXO 6.0 milestone May 31, 2026
@gharlan gharlan merged commit 5e85ef9 into 6.x May 31, 2026
16 checks passed
@gharlan gharlan deleted the refactor/addon-getpages branch May 31, 2026 06:59
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