Add action hooks and filters to Projects and Project templates #1864
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Customizing the GlotPress UI relies heavily on the templates.
If multiple plugins are used to add funcionallities, and all rely on templates, one could either use templates from one or other plugin, not both. On top of this, there is no template versioning, so, it's hard to keep track and keep templates up to date.
If one wants to add a custom column to the Translation Sets table, can use only one extra column with the hook
gp_project_template_translation_set_extra
, the column is labeled "Extra" with the custom data in it.Solution
This PR adds some more hooks and filters to allow adding features with plugins without the need to override templates.
This is also a good practice to keep templates up to date.
Templates and hooks
projects.php
gp_projects_template_project_items
Allows to filter an array of the project items like name, buttons and bubble in the projects template.
project.php
gp_project_template_subproject_items
Allows to filter an array of the subproject items like name, buttons and bubble in the project template.
gp_project_template_translation_set_manage_columns
Allows to filter the Translation Sets table columns, in the same WP way of manage_{$screen->id}_columns.
gp_project_template_translation_set_custom_column
Allows to add Translation Sets table custom columns, in the same WP way of manage_plugins_custom_column.
Testing Instructions