Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Allow more than one "after" callback #182

Open
efc opened this issue Nov 2, 2024 · 0 comments
Open

Suggestion: Allow more than one "after" callback #182

efc opened this issue Nov 2, 2024 · 0 comments
Labels
feature request New feature or request

Comments

@efc
Copy link

efc commented Nov 2, 2024

I have already written two "after" functions for SSG, one to do some URL rewriting and one to generate HTML redirect pages. It seems to me that different addon authors might want to create their own SSG::after functions as well. But it seems that only the last SSG::after function is saved and called by SSG (see the definition in /src/Generator.php...

    public function after($after)
    {
        $this->after = $after;

        return $this;
    }

Wouldn't it make more sense to allow multiple functions to be "registered" and called, so that multiple addons might hook onto the tail end of a static site generation to do whatever cleanup they need for their own data?

I'm not sure how to best accomplish this, probably does not need to be as sophisticated as the WP hook mechanism (though that is not a bad model, and accounts for things like managing the order of callback). Maybe even just a simple array of after callbacks would be enough?

@duncanmcclean duncanmcclean added the feature request New feature or request label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants