-
Notifications
You must be signed in to change notification settings - Fork 6
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 a view display extender for the localgov_page_header for the lede #257
base: 2.x
Are you sure you want to change the base?
Add a view display extender for the localgov_page_header for the lede #257
Conversation
d02dade
to
6f3421c
Compare
Fix #127 Adds a setting to views that allows for a page header category, with the option to set a custom lede inside the view, which will then be used by the page header block.
6f3421c
to
5baf187
Compare
@Adnan-cds can see this will be potentially useful! |
…yEvent Since a viewExecutable is not a child of EntityInterface, provide seperate $view property and set that when viewing a view page from the pageHeaderBlock.
161dbe8
to
c9c7ad9
Compare
It works! Thanks Andy :) The code looks okay at first glance. I would suggest that Steve @stephen-cox does a thorough review. |
Some questions from Merge Tuesday:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with this approach. One small nitpick with a type hint that's wrong and can probably be removed.
This does add a hard dependency between Core and Views. I don't have a problem with this as I can't think of an LGD site that wouldn't use Views, but we should add the dependency in the info.yml file.
I think it would also be good to enable this by default and maybe add an update hook to enable it for others. The test already includes the code on how to do this.
localgov_core/tests/src/Functional/ViewsPageExtenderTest.php
Lines 40 to 44 in c9c7ad9
$config = \Drupal::service('config.factory')->getEditable('views.settings'); | |
$display_extenders = $config->get('display_extenders') ?: []; | |
$display_extenders[] = 'localgov_page_header_display_extender'; | |
$config->set('display_extenders', $display_extenders); | |
$config->save(); |
* {@inheritdoc} | ||
*/ | ||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { | ||
/** @var \Drupal\metatag_views\Plugin\views\display_extender\MetatagDisplayExtender */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type hint references the Metatag display extender and isn't needed here anyway
- Enables by default and adds update hook. - Removes the install from the test.
@stephen-cox Will test the update hook and merge if okay |
Discussed on MT on 28/1/2025: We'd like to get this reviewed soon. @ekes @stephen-cox please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good to me 👍
Fix #127
What does this change?
Adds a setting to views that allows for a page header category, with the option
to set a custom lede inside the view, which will then be used by the
page header block.
How to test
How can we measure success?
Now possible for site builders to add subtitles to views.
Have we considered potential risks?
May conflict with others who have added their own extension to get a subtitle on the view.
Images
Accessibility