Skip to content
Snippets Groups Projects
Verified Commit a28538b0 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3421005 by Ruturaj Chaubey, sorlov, quietone, smustgrave, larowlan,...

Issue #3421005 by Ruturaj Chaubey, sorlov, quietone, smustgrave, larowlan, alexpott: Convert ViewsStyle plugin discovery to attributes

(cherry picked from commit f944f488)
parent dd091490
Branches
Tags
33 merge requests!12802Issue #3537193 by opauwlo: Add enable absolute path option for CKEditor5 image uploads,!12745Fixed: Path alias language doesn't changes on changing of node language,!12684Issue #3220784,!12537Add ViewsConfigUpdater deprecation support for default_argument_skip_url,!12523Issue #3493858 by vidorado, xavier.masson, smustgrave: Extend ViewsBlockBase...,!122353526426-warning-for-missing,!12212Issue #3445525 by alexpott, japerry, catch, mglaman, longwave: Add BC layer...,!11958Issue #3490507 by alexpott, smustgrave: Fix bogus mocking in...,!11769Issue #3517987: Add option to contextual filters to encode slashes in query parameter.,!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9944Issue #3483353: Consider making the createCopy config action optionally fail...,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!9526Issue #3458177 by mondrake, catch, quietone, godotislate, longwave, larowlan,...,!8738Issue #3424162 by camilledavis, dineshkumarbollu, smustgrave: Claro...,!8704Make greek characters available in ckeditor5,!8597Draft: Issue #3442259 by catch, quietone, dww: Reduce time of Migrate Upgrade tests...,!8533Issue #3446962 by kim.pepper: Remove incorrectly added...,!8517Issue #3443748 by NexusNovaz, smustgrave: Testcase creates false positive,!8325Update file Sort.php,!8095Expose document root on install,!7930Resolve #3427374 "Taxonomytid viewsargumentdefault plugin",!7627Issue #3439440 by nicxvan, Binoli Lalani, longwave: Remove country support from DateFormatter,!7445Issue #3440169: When using drupalGet(), provide an associative array for $headers,!7401#3271894 Fix documented StreamWrapperInterface return types for realpath() and dirname(),!7384Add constraints to system.advisories,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #130697 passed with warnings
Pipeline: drupal

#130703

    Pipeline: drupal

    #130701

      Showing
      with 190 additions and 113 deletions
      ......@@ -5,6 +5,8 @@
      use Drupal\Core\Cache\Cache;
      use Drupal\Core\Cache\CacheableDependencyInterface;
      use Drupal\Core\Form\FormStateInterface;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\views\Attribute\ViewsStyle;
      use Drupal\views\Plugin\views\style\StylePluginBase;
      use Symfony\Component\DependencyInjection\ContainerInterface;
      use Symfony\Component\Serializer\SerializerInterface;
      ......@@ -13,14 +15,13 @@
      * The style plugin for serialized output formats.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "serializer",
      * title = @Translation("Serializer"),
      * help = @Translation("Serializes views row data using the Serializer component."),
      * display_types = {"data"}
      * )
      */
      #[ViewsStyle(
      id: "serializer",
      title: new TranslatableMarkup("Serializer"),
      help: new TranslatableMarkup("Serializes views row data using the Serializer component."),
      display_types: ["data"],
      )]
      class Serializer extends StylePluginBase implements CacheableDependencyInterface {
      /**
      ......
      <?php
      declare(strict_types=1);
      namespace Drupal\views\Attribute;
      use Drupal\Component\Plugin\Attribute\Plugin;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      /**
      * Defines a views style plugins type attribute for plugin discovery.
      *
      * @see \Drupal\views\Plugin\views\style\StylePluginBase
      *
      * @ingroup views_style_plugins
      */
      #[\Attribute(\Attribute::TARGET_CLASS)]
      class ViewsStyle extends Plugin {
      /**
      * Constructs a ViewsStyle attribute.
      *
      * @param string $id
      * The plugin ID.
      * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $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
      * (optional) The theme function used to render the style output.
      * @param string[] $display_types
      * The types of the display this plugin can be used with.
      * For example the Feed display defines the type 'feed', so only rss style
      * and row plugins can be used in the views UI.
      * @param string[] $base
      * (optional) The base tables on which this access plugin can be used.
      * If no base table is specified the plugin can be used with all tables.
      * @param bool $no_ui
      * (optional) Whether the plugin should be not selectable in the UI.
      * If set to TRUE, you can still use it via the API in config files.
      * Defaults to FALSE.
      * @param bool $register_theme
      * (optional) Whether or not to register a theme function automatically.
      * @param class-string|null $deriver
      * (optional) The deriver class.
      */
      public function __construct(
      public readonly string $id,
      public readonly TranslatableMarkup $title,
      public readonly ?TranslatableMarkup $short_title = NULL,
      public readonly ?TranslatableMarkup $help = NULL,
      public readonly ?string $theme = NULL,
      public readonly array $display_types = [],
      public readonly array $base = [],
      public readonly bool $no_ui = FALSE,
      public readonly bool $register_theme = TRUE,
      public readonly ?string $deriver = NULL
      ) {}
      }
      ......@@ -2,21 +2,23 @@
      namespace Drupal\views\Plugin\views\style;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\views\Attribute\ViewsStyle;
      /**
      * Unformatted style plugin to render rows.
      *
      * Row are rendered one after another with no decorations.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "default",
      * title = @Translation("Unformatted list"),
      * help = @Translation("Displays rows one after another."),
      * theme = "views_view_unformatted",
      * display_types = {"normal"}
      * )
      */
      #[ViewsStyle(
      id: "default",
      title: new TranslatableMarkup("Unformatted list"),
      help: new TranslatableMarkup("Displays rows one after another."),
      theme: "views_view_unformatted",
      display_types: ["normal"],
      )]
      class DefaultStyle extends StylePluginBase {
      /**
      ......
      ......@@ -3,20 +3,21 @@
      namespace Drupal\views\Plugin\views\style;
      use Drupal\Core\Form\FormStateInterface;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\views\Attribute\ViewsStyle;
      /**
      * The default style plugin for summaries.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "default_summary",
      * title = @Translation("List"),
      * help = @Translation("Displays the default summary as a list."),
      * theme = "views_view_summary",
      * display_types = {"summary"}
      * )
      */
      #[ViewsStyle(
      id: "default_summary",
      title: new TranslatableMarkup("List"),
      help: new TranslatableMarkup("Displays the default summary as a list."),
      theme: "views_view_summary",
      display_types: ["summary"],
      )]
      class DefaultSummary extends StylePluginBase {
      protected function defineOptions() {
      ......
      ......@@ -4,21 +4,22 @@
      use Drupal\Component\Utility\Xss;
      use Drupal\Core\Form\FormStateInterface;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\views\Attribute\ViewsStyle;
      /**
      * EntityReference style plugin.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "entity_reference",
      * title = @Translation("Entity Reference list"),
      * help = @Translation("Returns results as a PHP array of labels and rendered rows."),
      * theme = "views_view_unformatted",
      * register_theme = FALSE,
      * display_types = {"entity_reference"}
      * )
      */
      #[ViewsStyle(
      id: "entity_reference",
      title: new TranslatableMarkup("Entity Reference list"),
      help: new TranslatableMarkup("Returns results as a PHP array of labels and rendered rows."),
      theme: "views_view_unformatted",
      register_theme: FALSE,
      display_types: ["entity_reference"],
      )]
      class EntityReference extends StylePluginBase {
      /**
      ......
      ......@@ -4,20 +4,21 @@
      use Drupal\Component\Utility\Html;
      use Drupal\Core\Form\FormStateInterface;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\views\Attribute\ViewsStyle;
      /**
      * Style plugin to render each item in a grid cell.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "grid",
      * title = @Translation("Grid"),
      * help = @Translation("Displays rows in a grid."),
      * theme = "views_view_grid",
      * display_types = {"normal"}
      * )
      */
      #[ViewsStyle(
      id: "grid",
      title: new TranslatableMarkup("Grid"),
      help: new TranslatableMarkup("Displays rows in a grid."),
      theme: "views_view_grid",
      display_types: ["normal"],
      )]
      class Grid extends StylePluginBase {
      /**
      ......
      ......@@ -3,20 +3,21 @@
      namespace Drupal\views\Plugin\views\style;
      use Drupal\Core\Form\FormStateInterface;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\views\Attribute\ViewsStyle;
      /**
      * Style plugin to render each item in a responsive grid cell.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "grid_responsive",
      * title = @Translation("Responsive Grid"),
      * help = @Translation("Displays rows in a responsive grid."),
      * theme = "views_view_grid_responsive",
      * display_types = {"normal"}
      * )
      */
      #[ViewsStyle(
      id: "grid_responsive",
      title: new TranslatableMarkup("Responsive Grid"),
      help: new TranslatableMarkup("Displays rows in a responsive grid."),
      theme: "views_view_grid_responsive",
      display_types: ["normal"],
      )]
      class GridResponsive extends StylePluginBase {
      /**
      ......
      ......@@ -3,20 +3,21 @@
      namespace Drupal\views\Plugin\views\style;
      use Drupal\Core\Form\FormStateInterface;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\views\Attribute\ViewsStyle;
      /**
      * Style plugin to render each item in an ordered or unordered list.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "html_list",
      * title = @Translation("HTML List"),
      * help = @Translation("Displays rows as HTML list."),
      * theme = "views_view_list",
      * display_types = {"normal"}
      * )
      */
      #[ViewsStyle(
      id: "html_list",
      title: new TranslatableMarkup("HTML List"),
      help: new TranslatableMarkup("Displays rows as HTML list."),
      theme: "views_view_list",
      display_types: ["normal"],
      )]
      class HtmlList extends StylePluginBase {
      /**
      ......
      ......@@ -2,21 +2,22 @@
      namespace Drupal\views\Plugin\views\style;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\Core\Url;
      use Drupal\views\Attribute\ViewsStyle;
      /**
      * Default style plugin to render an OPML feed.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "opml",
      * title = @Translation("OPML Feed"),
      * help = @Translation("Generates an OPML feed from a view."),
      * theme = "views_view_opml",
      * display_types = {"feed"}
      * )
      */
      #[ViewsStyle(
      id: "opml",
      title: new TranslatableMarkup("OPML Feed"),
      help: new TranslatableMarkup("Generates an OPML feed from a view."),
      theme: "views_view_opml",
      display_types: ["feed"],
      )]
      class Opml extends StylePluginBase {
      /**
      ......
      ......@@ -3,21 +3,22 @@
      namespace Drupal\views\Plugin\views\style;
      use Drupal\Core\Form\FormStateInterface;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\Core\Url;
      use Drupal\views\Attribute\ViewsStyle;
      /**
      * Default style plugin to render an RSS feed.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "rss",
      * title = @Translation("RSS Feed"),
      * help = @Translation("Generates an RSS feed from a view."),
      * theme = "views_view_rss",
      * display_types = {"feed"}
      * )
      */
      #[ViewsStyle(
      id: "rss",
      title: new TranslatableMarkup("RSS Feed"),
      help: new TranslatableMarkup("Generates an RSS feed from a view."),
      theme: "views_view_rss",
      display_types: ["feed"],
      )]
      class Rss extends StylePluginBase {
      /**
      ......
      ......@@ -6,21 +6,22 @@
      use Drupal\Core\Cache\Cache;
      use Drupal\Core\Cache\CacheableDependencyInterface;
      use Drupal\Core\Form\FormStateInterface;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\views\Attribute\ViewsStyle;
      use Drupal\views\Plugin\views\wizard\WizardInterface;
      /**
      * Style plugin to render each item as a row in a table.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "table",
      * title = @Translation("Table"),
      * help = @Translation("Displays rows in a table."),
      * theme = "views_view_table",
      * display_types = {"normal"}
      * )
      */
      #[ViewsStyle(
      id: "table",
      title: new TranslatableMarkup("Table"),
      help: new TranslatableMarkup("Displays rows in a table."),
      theme: "views_view_table",
      display_types: ["normal"],
      )]
      class Table extends StylePluginBase implements CacheableDependencyInterface {
      /**
      ......
      ......@@ -3,20 +3,21 @@
      namespace Drupal\views\Plugin\views\style;
      use Drupal\Core\Form\FormStateInterface;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\views\Attribute\ViewsStyle;
      /**
      * The default style plugin for summaries.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "unformatted_summary",
      * title = @Translation("Unformatted"),
      * help = @Translation("Displays the summary unformatted, with option for one after another or inline."),
      * theme = "views_view_summary_unformatted",
      * display_types = {"summary"}
      * )
      */
      #[ViewsStyle(
      id: "unformatted_summary",
      title: new TranslatableMarkup("Unformatted"),
      help: new TranslatableMarkup("Displays the summary unformatted, with option for one after another or inline."),
      theme: "views_view_summary_unformatted",
      display_types: ["summary"],
      )]
      class UnformattedSummary extends DefaultSummary {
      protected function defineOptions() {
      ......
      ......@@ -2,6 +2,8 @@
      namespace Drupal\views_test_data\Plugin\views\style;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\views\Attribute\ViewsStyle;
      use Drupal\views\Plugin\views\style\Mapping;
      use Drupal\views\Plugin\views\field\NumericField;
      ......@@ -9,15 +11,14 @@
      * Provides a test plugin for the mapping style.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "mapping_test",
      * title = @Translation("Field mapping"),
      * help = @Translation("Maps specific fields to specific purposes."),
      * theme = "views_view_mapping_test",
      * display_types = {"normal", "test"}
      * )
      */
      #[ViewsStyle(
      id: "mapping_test",
      title: new TranslatableMarkup("Field mapping"),
      help: new TranslatableMarkup("Maps specific fields to specific purposes."),
      theme: "views_view_mapping_test",
      display_types: ["normal", "test"],
      )]
      class MappingTest extends Mapping {
      /**
      ......
      ......@@ -2,21 +2,22 @@
      namespace Drupal\views_test_data\Plugin\views\style;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\views\Attribute\ViewsStyle;
      use Drupal\views\Plugin\views\style\StylePluginBase;
      /**
      * Provides a general test style template plugin.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "test_template_style",
      * title = @Translation("Test style template plugin"),
      * help = @Translation("Provides a generic style template test plugin."),
      * theme = "views_view_style_template_test",
      * display_types = {"normal", "test"}
      * )
      */
      #[ViewsStyle(
      id: "test_template_style",
      title: new TranslatableMarkup("Test style template plugin"),
      help: new TranslatableMarkup("Provides a generic style template test plugin."),
      theme: "views_view_style_template_test",
      display_types: ["normal", "test"],
      )]
      class StyleTemplateTest extends StylePluginBase {
      /**
      ......
      ......@@ -3,22 +3,23 @@
      namespace Drupal\views_test_data\Plugin\views\style;
      use Drupal\Core\Form\FormStateInterface;
      use Drupal\Core\StringTranslation\TranslatableMarkup;
      use Drupal\views\Attribute\ViewsStyle;
      use Drupal\views\Plugin\views\style\StylePluginBase;
      /**
      * Provides a general test style plugin.
      *
      * @ingroup views_style_plugins
      *
      * @ViewsStyle(
      * id = "test_style",
      * title = @Translation("Test style plugin"),
      * help = @Translation("Provides a generic style test plugin."),
      * theme = "views_view_style_test",
      * register_theme = FALSE,
      * display_types = {"normal", "test"}
      * )
      */
      #[ViewsStyle(
      id: "test_style",
      title: new TranslatableMarkup("Test style plugin"),
      help: new TranslatableMarkup("Provides a generic style test plugin."),
      theme: "views_view_style_test",
      register_theme: FALSE,
      display_types: ["normal", "test"],
      )]
      class StyleTest extends StylePluginBase {
      /**
      ......
      0% Loading or .
      You are about to add 0 people to the discussion. Proceed with caution.
      Please register or to comment