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

Add action hooks and filters to Projects and Project templates #1864

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

pedro-mendonca
Copy link
Member

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

  1. Check the root Projects and single Project pages, all the default behavior should be kept.
  2. Add custom columns and filter the project row items in the projects lists and check how easy it is to customize.

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.

1 participant