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

Issue #3421009 by sorlov, mohit_aghera, pradhumanjain2311, larowlan,...

Issue #3421009 by sorlov, mohit_aghera, pradhumanjain2311, larowlan, smustgrave, alexpott: Convert ViewsCache plugin discovery to attributes

(cherry picked from commit c077be8a)
parent 675d0495
No related branches found
No related tags found
30 merge requests!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,!7078Issue #3320569 by Spokje, mondrake, smustgrave, longwave, quietone, Lendude,...,!6622Issue #2559833 by piggito, mohit_aghera, larowlan, guptahemant, vakulrai,...,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
<?php
namespace Drupal\views\Attribute;
use Drupal\Component\Plugin\Attribute\Plugin;
use Drupal\Core\StringTranslation\TranslatableMarkup;
/**
* Defines a views cache plugins type attribute for plugin discovery.
*
* @see \Drupal\views\Plugin\views\cache\CachePluginBase
*
* @ingroup views_cache_plugins
*/
#[\Attribute(\Attribute::TARGET_CLASS)]
class ViewsCache extends Plugin {
/**
* Constructs a ViewsCache 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 $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
* The base tables on which this cache plugin can be used.
* If no base table is specified the plugin can be used with all tables.
* @param bool $no_ui
* 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.
* @param class-string|null $deriver
* (optional) The deriver class.
*/
public function __construct(
public readonly string $id,
public readonly ?TranslatableMarkup $title = NULL,
public readonly ?TranslatableMarkup $short_title = NULL,
public readonly ?TranslatableMarkup $help = NULL,
public readonly ?array $display_types = NULL,
public readonly array $base = [],
public readonly ?bool $no_ui = NULL,
public readonly ?string $deriver = NULL
) {}
}
......@@ -2,17 +2,19 @@
namespace Drupal\views\Plugin\views\cache;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\views\Attribute\ViewsCache;
/**
* Caching plugin that provides no caching at all.
*
* @ingroup views_cache_plugins
*
* @ViewsCache(
* id = "none",
* title = @Translation("None"),
* help = @Translation("No caching of Views data.")
* )
*/
#[ViewsCache(
id: 'none',
title: new TranslatableMarkup('None'),
help: new TranslatableMarkup('No caching of Views data.'),
)]
class None extends CachePluginBase {
public function summaryTitle() {
......
......@@ -3,18 +3,19 @@
namespace Drupal\views\Plugin\views\cache;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\views\Attribute\ViewsCache;
/**
* Simple caching of query results for Views displays.
*
* @ingroup views_cache_plugins
*
* @ViewsCache(
* id = "tag",
* title = @Translation("Tag based"),
* help = @Translation("Tag based caching of data. Caches will persist until any related cache tags are invalidated.")
* )
*/
#[ViewsCache(
id: 'tag',
title: new TranslatableMarkup('Tag based'),
help: new TranslatableMarkup('Tag based caching of data. Caches will persist until any related cache tags are invalidated.'),
)]
class Tag extends CachePluginBase {
/**
......
......@@ -6,19 +6,20 @@
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\views\Attribute\ViewsCache;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Simple caching of query results for Views displays.
*
* @ingroup views_cache_plugins
*
* @ViewsCache(
* id = "time",
* title = @Translation("Time-based"),
* help = @Translation("Simple time-based caching of data.")
* )
*/
#[ViewsCache(
id: 'time',
title: new TranslatableMarkup('Time-based'),
help: new TranslatableMarkup('Simple time-based caching of data.'),
)]
class Time extends CachePluginBase {
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment