Skip to content
This repository was archived by the owner on Jul 28, 2024. It is now read-only.
This repository was archived by the owner on Jul 28, 2024. It is now read-only.

Dynamic action priorities #1232

@borekb

Description

@borekb

PR #1228 implemented new filter vp_action_priority_{$scope}, see diff, but there has also been some discussion about other options. Specifically, @pavelevap noted that special WPLANG handling is not evident from the actions.yml file and can be missed:

option:
  actions:
    create: Created option '%VPID%'
    edit:
      message: Edited option '%VPID%'
      priority: 12
    delete: Deleted option '%VPID%'

That is true although it could be said for many other things in hooks.php. Still, we discussed with @JanVoracek what we could do about that. Some option would be something like this:

option:
  actions:
    create:
      message: Created option '%VPID%'
      priority: 10
      priority(option_name==WPLANG): 20

But it's not really accurate: in this case, the rule is more complex and would need to be something like:

option:
 actions:
   create:
     message: Created option '%VPID%'
     priority: 10
     priority(option_name=='WPLANG' && option_value==''): 20

We're now basically embedding code into YAML which didn't look like a good idea.

Another idea was to call a function, similarly to what's possible in schema.yml:

option:
 actions:
   create:
     message: Created option '%VPID%'
     priority: 10
     priority_WPLANG: @getWplangPriority

But that probably wouldn't work as determining priority doesn't seem to be deterministic here.

So it seems that the vp_action_priority_{$scope} filter as per #1228 is a reasonable solution for now, maybe combined with some comment in the YAML file (although, again, hooks.php is full of stuff to be aware of).


🏁 PR #1228

Metadata

Metadata

Assignees

Labels

featureNew feature. See "improvement" for updates of existing functionality.noteworthySignificant issue or PR, to be highlighted in release notesplugin supportIssues related to the main feature of 4.0, plugin support.scope: coreCore VersionPress functionality like tracking actions, creating Git commits, etc.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions