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

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

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

(cherry picked from commit 0eca710d)
parent b5f62fa4
No related branches found
No related tags found
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 #132399 passed with warnings
Pipeline: drupal

#132406

    <?php
    namespace Drupal\views\Attribute;
    use Drupal\Component\Plugin\Attribute\Plugin;
    use Drupal\Core\StringTranslation\TranslatableMarkup;
    /**
    * Defines a views pager plugins type attribute for plugin discovery.
    *
    * @see \Drupal\views\Plugin\views\pager\PagerPluginBase
    *
    * @ingroup views_pager_plugins
    */
    #[\Attribute(\Attribute::TARGET_CLASS)]
    class ViewsPager extends Plugin {
    /**
    * Constructs a ViewsPager attribute.
    *
    * @param string $id
    * The plugin ID.
    * @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
    * (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
    * 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 = NULL,
    public readonly array $base = [],
    public readonly bool $no_ui = FALSE,
    public readonly bool $register_theme = TRUE,
    public readonly ?string $deriver = NULL
    ) {}
    }
    ......@@ -3,21 +3,22 @@
    namespace Drupal\views\Plugin\views\pager;
    use Drupal\Core\Form\FormStateInterface;
    use Drupal\Core\StringTranslation\TranslatableMarkup;
    use Drupal\views\Attribute\ViewsPager;
    /**
    * The plugin to handle full pager.
    *
    * @ingroup views_pager_plugins
    *
    * @ViewsPager(
    * id = "full",
    * title = @Translation("Paged output, full pager"),
    * short_title = @Translation("Full"),
    * help = @Translation("Paged output, full Drupal style"),
    * theme = "pager",
    * register_theme = FALSE
    * )
    */
    #[ViewsPager(
    id: "full",
    title: new TranslatableMarkup("Paged output, full pager"),
    short_title: new TranslatableMarkup("Full"),
    help: new TranslatableMarkup("Paged output, full Drupal style"),
    theme: "pager",
    register_theme: FALSE
    )]
    class Full extends SqlBase {
    /**
    ......
    ......@@ -2,19 +2,21 @@
    namespace Drupal\views\Plugin\views\pager;
    use Drupal\Core\StringTranslation\TranslatableMarkup;
    use Drupal\views\Attribute\ViewsPager;
    /**
    * The plugin to handle mini pager.
    *
    * @ingroup views_pager_plugins
    *
    * @ViewsPager(
    * id = "mini",
    * title = @Translation("Paged output, mini pager"),
    * short_title = @Translation("Mini"),
    * help = @Translation("A simple pager containing previous and next links."),
    * theme = "views_mini_pager"
    * )
    */
    #[ViewsPager(
    id: "mini",
    title: new TranslatableMarkup("Paged output, mini pager"),
    short_title: new TranslatableMarkup("Mini"),
    help: new TranslatableMarkup("A simple pager containing previous and next links."),
    theme: "views_mini_pager",
    )]
    class Mini extends SqlBase {
    /**
    ......@@ -47,7 +49,7 @@ public function summaryTitle() {
    public function query() {
    parent::query();
    // Only modify the query if we don't want to do a total row count
    // Only modify the query if we don't want to do a total row count.
    if (!$this->view->get_total_rows) {
    // Don't query for the next page if we have a pager that has a limited
    // amount of pages.
    ......@@ -72,7 +74,7 @@ public function useCountQuery() {
    * {@inheritdoc}
    */
    public function postExecute(&$result) {
    // Only modify the result if we didn't do a total row count
    // Only modify the result if we didn't do a total row count.
    if (!$this->view->get_total_rows) {
    $this->total_items = $this->getCurrentPage() * $this->getItemsPerPage() + count($result);
    // query() checks if we need a next link by setting limit 1 record past
    ......
    ......@@ -3,6 +3,8 @@
    namespace Drupal\views\Plugin\views\pager;
    use Drupal\Core\Form\FormStateInterface;
    use Drupal\Core\StringTranslation\TranslatableMarkup;
    use Drupal\views\Attribute\ViewsPager;
    use Drupal\views\ViewExecutable;
    use Drupal\views\Plugin\views\display\DisplayPluginBase;
    ......@@ -10,14 +12,13 @@
    * Plugin for views without pagers.
    *
    * @ingroup views_pager_plugins
    *
    * @ViewsPager(
    * id = "none",
    * title = @Translation("Display all items"),
    * help = @Translation("Display all items that this view might find."),
    * display_types = {"basic"}
    * )
    */
    #[ViewsPager(
    id: "none",
    title: new TranslatableMarkup("Display all items"),
    help: new TranslatableMarkup("Display all items that this view might find."),
    display_types: ["basic"],
    )]
    class None extends PagerPluginBase {
    /**
    ......
    ......@@ -15,7 +15,7 @@
    * and setting up the pager.
    *
    * Pager plugins extend \Drupal\views\Plugin\views\pager\PagerPluginBase. They
    * must be annotated with \Drupal\views\Annotation\ViewsPager annotation,
    * must be attributed with \Drupal\views\Annotation\ViewsPager attribute,
    * and they must be in namespace directory Plugin\views\pager.
    *
    * @ingroup views_plugins
    ......
    ......@@ -3,19 +3,20 @@
    namespace Drupal\views\Plugin\views\pager;
    use Drupal\Core\Form\FormStateInterface;
    use Drupal\Core\StringTranslation\TranslatableMarkup;
    use Drupal\views\Attribute\ViewsPager;
    /**
    * Plugin for views without pagers.
    *
    * @ingroup views_pager_plugins
    *
    * @ViewsPager(
    * id = "some",
    * title = @Translation("Display a specified number of items"),
    * help = @Translation("Display a limited number items that this view might find."),
    * display_types = {"basic"}
    * )
    */
    #[ViewsPager(
    id: "some",
    title: new TranslatableMarkup("Display a specified number of items"),
    help: new TranslatableMarkup("Display a limited number items that this view might find."),
    display_types: ["basic"],
    )]
    class Some extends PagerPluginBase {
    public function summaryTitle() {
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment