Skip to content

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

Open
@efc

Description

@efc

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions