Convert ViewsPager plugin discovery to attributes

Created on 13 February 2024, 8 months ago
Updated 12 April 2024, 6 months ago

Problem/Motivation

In ๐Ÿ“Œ Use PHP attributes instead of doctrine annotations Fixed we added support for attribute based plugin discovery.
As part of that issue we converted block and action plugins.

This issue is to convert \Drupal\views\Annotation\ViewsPagerplugins to use Attributes.

To do that we need ๐Ÿ“Œ Convert ViewsExposedForm and ViewsPluginAnnotationBase plugin discovery to attributes Active first. This issue is postponed on that.

Proposed resolution

  1. Add a class to represent the new Attribute - Example
  2. Update the plugin manager constructor to include both the attribute and annotation class names - example
  3. Convert all plugins that use the annotation to use the new attribute - example

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ“Œ Task
Status

Fixed

Version

10.3 โœจ

Component
Viewsย  โ†’

Last updated about 2 hours ago

Created by

๐Ÿ‡ฆ๐Ÿ‡บAustralia larowlan ๐Ÿ‡ฆ๐Ÿ‡บ๐Ÿ.au GMT+10

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @larowlan
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia larowlan ๐Ÿ‡ฆ๐Ÿ‡บ๐Ÿ.au GMT+10
  • Status changed to Active 8 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia larowlan ๐Ÿ‡ฆ๐Ÿ‡บ๐Ÿ.au GMT+10
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia larowlan ๐Ÿ‡ฆ๐Ÿ‡บ๐Ÿ.au GMT+10
  • Status changed to Postponed 8 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia larowlan ๐Ÿ‡ฆ๐Ÿ‡บ๐Ÿ.au GMT+10
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ
  • Status changed to Active 7 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ruturaj Chaubey Pune, India

    Ruturaj Chaubey โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Failed
    7 months ago
    Total: 182s
    #118804
  • Pipeline finished with Failed
    7 months ago
    Total: 1122s
    #118807
  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ruturaj Chaubey Pune, India
  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Appears to have test failures

    Why was it tagged for tests?

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ruturaj Chaubey Pune, India
  • First commit to issue fork.
  • Pipeline finished with Failed
    7 months ago
    Total: 493s
    #119798
  • Pipeline finished with Failed
    7 months ago
    Total: 671s
    #121937
  • Pipeline finished with Failed
    7 months ago
    Total: 507s
    #122174
  • Pipeline finished with Failed
    7 months ago
    Total: 511s
    #123038
  • Pipeline finished with Failed
    7 months ago
    Total: 519s
    #123999
  • First commit to issue fork.
  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    In trying to figure out why the test was failing I notices that two of the plugins do not declare a theme. That means that 'register_theme' will be TRUE which makes no sense because there is no theme declared in the plugin. Therefore, this adds register_theme: FALSE, for those two plugins.

  • Status changed to RTBC 7 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Great investigative work @quietone!

    I'm seeing that fixed all the tests and searched the repo and all 4 instances of @ViewsPager have been replaced.

    I made 1 small nitpicky change adding "class-" to the driver.

  • Pipeline finished with Success
    7 months ago
    Total: 491s
    #129601
  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    $theme has the wrong default value - causing the problems with register theme.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    Here are the current definitions for none and some... let's not change register_theme. It'll be work once the attribute as a theme value set to NULL rather than an empty string. Which makes more sense anyways.

        "none" => [
          "parent" => "parent",
          "plugin_type" => "pager",
          "register_theme" => true,
          "title" => Drupal\Core\StringTranslation\TranslatableMarkup {#7635},
          "short_title" => "",
          "help" => Drupal\Core\StringTranslation\TranslatableMarkup {#7645},
          "id" => "none",
          "display_types" => [
            "basic",
          ],
          "class" => "Drupal\views\Plugin\views\pager\None",
          "provider" => "views",
        ],
        "some" => [
          "parent" => "parent",
          "plugin_type" => "pager",
          "register_theme" => true,
          "title" => Drupal\Core\StringTranslation\TranslatableMarkup {#7647},
          "short_title" => "",
          "help" => Drupal\Core\StringTranslation\TranslatableMarkup {#7648},
          "id" => "some",
          "display_types" => [
            "basic",
          ],
          "class" => "Drupal\views\Plugin\views\pager\Some",
          "provider" => "views",
        ],
    
  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    @alexpott, thanks for the changes. I thought I had changed $theme to NULL and tested before I went on holiday. I guess I was wrong about that. Maybe I should have tried again.

    Changes made, tests are passing. So back to needs review.

  • Status changed to RTBC 7 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    So " vs ' I don't think there is a standard for that right?

    I see for example #[ViewsRow are using " but #[ViewsArgument used '

    Most appear to be using " but if a follow up is needed to fix #[ViewsArgument then we should maybe make it inline too right?

    #[ViewsArgument("node_type")]
    

    vs

    #[ViewsArgument(
      id: 'node_type',
    )]
    

    But changes here look good.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    Committed and pushed 0eca710d8b to 11.x and 95bfc525bd to 10.3.x. Thanks!

    diff --git a/core/modules/views/src/Attribute/ViewsPager.php b/core/modules/views/src/Attribute/ViewsPager.php
    index 0c222c4e03..2a19944ced 100644
    --- a/core/modules/views/src/Attribute/ViewsPager.php
    +++ b/core/modules/views/src/Attribute/ViewsPager.php
    @@ -20,14 +20,14 @@ class ViewsPager extends Plugin {
        *
        * @param string $id
        *   The plugin ID.
    -   * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $title
    +   * @param \Drupal\Core\StringTranslation\TranslatableMarkup $title
        *   The plugin title used in the views UI.
        * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $short_title
        *   (optional) The short title used in the views UI.
        * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $help
        *   (optional) A short help string; this is displayed in the views UI.
        * @param string|null $theme
    -   *   The theme function used to render the pager's output.
    +   *   (optional) The theme function used to render the pager's output.
        * @param string[]|null $display_types
        *   (optional) The types of the display this plugin can be used with.
        *   For example the Feed display defines the type 'feed', so only rss style
    

    Fixed on commit.

  • Status changed to Fixed 7 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024