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

EZP-29848: Make existing AdminUI tabs extendable by allowing template path and parameters change #728

Merged
merged 3 commits into from
Dec 7, 2018

Conversation

webhdx
Copy link
Contributor

@webhdx webhdx commented Nov 30, 2018

Question Answer
Tickets https://jira.ez.no/browse/EZP-29848
Bug fix? no
New feature? yes
BC breaks? no
Tests pass? yes
Doc needed? yes
License GPL-2.0
  1. Introduced new abstract class EventDispatchingAbstractTab which dispatches TabEvents::ON_RENDER event before rendering tab. This gives a flexibility of changing template and accessing parameters to modify them.
  2. I've added some useful twig blocks to Versions tab allowing to add custom columns and tables from other bundles. It's being used by upcoming Workflow bundle.

TODO

  • Implement EventDispatchingAbstractTab in other tabs after validating idea on code review

@webhdx webhdx self-assigned this Nov 30, 2018
@webhdx webhdx changed the title Ezp 29848 extendable tabs EZP-29848: Make existing AdminUI tabs extendable by allowing template path and parameters change Nov 30, 2018
'attr': { 'class': 'ez-toggle-btn-state', 'data-toggle-button-id': '#delete-translations-' ~ form_version_remove_archived.remove.vars.id }
}) }}
{% include '@ezdesign/parts/table_header.html.twig' with { headerText: 'tab.versions.archived_versions'|trans()|desc('Archived versions'), tools: tab.table_header_tools(form_version_remove_archived) } %}
{% block table_wrapper_archived %}
{% if archived_versions is not empty %}
Copy link
Contributor Author

@webhdx webhdx Nov 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review note - this if statement is always true because it has been already checked a few lines above thus else block is never reached.

{% if published_versions is not empty %}
{{ include('@ezdesign/content/tab/versions/table.html.twig', { 'versions': published_versions }) }}
{% else %}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review note: Same as below.

@webhdx webhdx force-pushed the EZP-29848_extendable_tabs branch from 18f2ce8 to 7628ef0 Compare November 30, 2018 10:31
/**
* @param string $tabIdentifier
*/
public function setTabIdentifier(string $tabIdentifier): void
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change a tab identifier after creation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, no we should not.

/**
* Is dispatched on tabs extending EventDispatchingAbstractTab.
*
* Allows to manipulate template path and parameters before rendering by Twig.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we allow changing the identifier than the comment should be changed.

@webhdx webhdx force-pushed the EZP-29848_extendable_tabs branch from 7628ef0 to fb52fa5 Compare December 6, 2018 11:07
@lserwatka
Copy link
Member

Note for QA: we only need sanities here. cc @micszo

@micszo micszo self-assigned this Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants