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

Set plugin event priority #130

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

hugopeek
Copy link

Currently you can only define an array of event names in the config, but the plugin_events table allows you to also set a priority and propertyset for each event.

They are both hardcoded now to 0, but for the rare occasions where you'd need to change that, this update adds the option to define each event as a separate JSON object in the config:

{
    "package":{
        "elements": {
            "plugins": [{
                "name": "PackagePlugin",
                "events": [
                    {
                        "event": "OnDocFormSave",
                        "priority": 10
                    },{
                        "event": "OnWebPagePrerender",
                        "propertyset": 5
                    }
                ]
            }]
        }
    }
}

It will still fall back to 0 if you don't provide a propertyset or priority, and the current format of only entering an array of event names also still works.

@hugopeek
Copy link
Author

This also answers #127 btw..

@theboxer
Copy link
Owner

Referencing property set in a config by an ID is a no-go. IDs change.

@hugopeek hugopeek changed the title Set plugin event priority and propertyset Set plugin event priority Jul 2, 2021
@hugopeek
Copy link
Author

hugopeek commented Jul 2, 2021

You're right, referencing property set by ID is a bad idea. The thing is: it's being reset to default (0) each time you update the package. So there's currently no way to use a custom set, without reassigning it after every update.

I removed the property set feature in this PR and will try to create a separate PR for the reset issue. So this PR is now purely about updating even priority.

@sebastian-marinescu
Copy link

Nice feature, thanks @hugopeek
Will come in handy! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants