Skip to content

Theme Events: Added events for page content render and pre-save #6049

Closed

Description

@ssddanbrown

Description

To allow a way for developer-focused back-end customization of content before it's saved, and/or before it's rendered to the user.

Been quite a few cases where this would have helped on instance where some very specific handling/tweaking to content was needed.

Activity

  1. self-assigned this
    on Mar 4, 2026
  2. ssddanbrown commented on Mar 6, 2026

    @ssddanbrown
    MemberAuthor

    Example of implementation

    <?php
    
    use BookStack\Entities\Models\Page;
    use BookStack\Facades\Theme;
    use BookStack\Theming\ThemeEvents;
    
    Theme::listen(ThemeEvents::PAGE_CONTENT_PRE_STORE, function (string $html, Page $page) {
        return str_replace('dog', 'cat', $html);
    });
    
    Theme::listen(ThemeEvents::PAGE_CONTENT_POST_RENDER, function (string $html, Page $page) {
        return str_replace('cat', 'badger', $html);
    });
  3. added a commit that references this issue on Mar 6, 2026
    27240be
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions