-
Notifications
You must be signed in to change notification settings - Fork 9
Add a view display extender for the localgov_page_header for the lede #257
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
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 👍
* Drupal 11 support (#262) Note: Allows linkit to upgrade to 7.0 * Declare Drupal 11 support #246 * feat: update linkit to recommended version * Add D11 tests workflow. * fix: update test module drupal core requirements * fix: should take an EventDispatcherInterface object, not ContainerAwareEventDispatcher * Patch for nullable types warning. * Patch for nullable types. * Workflows was merged into main. * Allow upgrading linkit to 7.0 but keep 6.1 for dependencies. Will drop 6.1 is next release. * Linkit has released a version with the nullable types patch. * Make module enable test something. New D11 phpunit tests fail if no assertion. --------- Co-authored-by: Lee Mills <lee@leemills.dev> Co-authored-by: ekes <ekes@iskra.net> * Add a view display extender for the localgov_page_header for the lede (#257) * Add a view display extender for the localgov_page_header for the lede 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. * Correct page header display extender title * Add seperate view property with setter and getter to pageHeaderDisplayEvent Since a viewExecutable is not a child of EntityInterface, provide seperate $view property and set that when viewing a view page from the pageHeaderBlock. * Add comment on why $view has to be rendered and cs fixes * Fix create docblock event in views display extender * Add views as dependency as pageDisplayExtender requires it * Enable the views page header display extender by default - Enables by default and adds update hook. - Removes the install from the test. * Fix missing return type errors --------- Co-authored-by: Stephen Cox <stephen-cox@users.noreply.github.com> Co-authored-by: Lee Mills <lee@leemills.dev> Co-authored-by: Andy Broomfield <andy.broomfield@brighton-hove.gov.uk>
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