diff --git a/includes/cache.inc b/includes/cache.inc index d4ec484f5326d09c543f827d189e4d6fa0720a9a..60c242b3012fdaf961486a19a05e1d123241197f 100644 --- a/includes/cache.inc +++ b/includes/cache.inc @@ -86,32 +86,14 @@ function _views_data_process_entity_types(&$data) { /** * Fetch the plugin data from cache. */ -function _views_fetch_plugin_data($type = NULL, $plugin = NULL, $reset = FALSE) { - static $cache = NULL; - if (!isset($cache) || $reset) { - $start = microtime(TRUE); - views_include('plugins'); - views_include_handlers(); - - $cache = views_discover_plugins(); - - } - - if (!$type && !$plugin) { - return $cache; - } - elseif (!$plugin) { - // Not in the if above so the else below won't run - if (isset($cache[$type])) { - return $cache[$type]; - } +function _views_fetch_plugin_data($type = NULL, $plugin_id = NULL, $reset = FALSE) { + $manager = views_get_plugin_manager($type); + if (!$plugin_id) { + return $manager->getDefinitions(); } - elseif (isset($cache[$type][$plugin])) { - return $cache[$type][$plugin]; + else { + return $manager->getDefinition($plugin_id); } - - // Return an empty array if there is no match. - return array(); } /** diff --git a/includes/handlers.inc b/includes/handlers.inc index 749d4a81924524d689ba70fc141bfe3fae26c48f..4796ffc4a18b5ea58d39b90646a0b1edf6e46fb1 100644 --- a/includes/handlers.inc +++ b/includes/handlers.inc @@ -20,11 +20,12 @@ */ function _views_create_plugin($type, $plugin_id, $definition) { $manager = views_get_plugin_manager($type); + $instance = $manager->createInstance($plugin_id); $instance->is_plugin = TRUE; $instance->plugin_type = $type; - $instance->plugin_name = $definition['name']; + $instance->plugin_name = $plugin_id; $instance->set_definition($definition); diff --git a/includes/plugins.inc b/includes/plugins.inc index a6a2720ca00c16cf3f4c798654ab41c3f78c4888..8e72578c8c7c9abb457cebfcfc7981cdd5c10184 100644 --- a/includes/plugins.inc +++ b/includes/plugins.inc @@ -7,402 +7,6 @@ use Drupal\views\ViewsObject; -/** - * Implements hook_views_plugins(). - */ -function views_views_plugins() { - $js_path = drupal_get_path('module', 'ctools') . '/js'; - $plugins = array( - // display, style, row, argument default, argument validator and access. - 'display' => array( - // Default settings for all display plugins. - 'default' => array( - 'title' => t('Master'), - 'help' => t('Default settings for this view.'), - 'class' => 'Drupal\views\Plugins\views\display\DefaultDisplay', - 'theme' => 'views_view', - 'no ui' => TRUE, - 'no remove' => TRUE, - // @todo: replace this with proper libraries. - // @TODO: figure out whether this is still needed, or at least remove depedent.js. - 'js' => array('core/misc/form.js', 'core/misc/collapse.js', 'core/misc/textarea.js', 'core/misc/tabledrag.js', 'core/misc/autocomplete.js', "$js_path/dependent.js"), - 'use ajax' => TRUE, - 'use pager' => TRUE, - 'use more' => TRUE, - 'accept attachments' => TRUE, - 'help topic' => 'display-default', - ), - 'page' => array( - 'title' => t('Page'), - 'help' => t('Display the view as a page, with a URL and menu links.'), - 'class' => 'Drupal\views\Plugins\views\display\Page', - 'theme' => 'views_view', - 'uses hook menu' => TRUE, - 'contextual links locations' => array('page'), - 'use ajax' => TRUE, - 'use pager' => TRUE, - 'use more' => TRUE, - 'accept attachments' => TRUE, - 'admin' => t('Page'), - 'help topic' => 'display-page', - ), - 'block' => array( - 'title' => t('Block'), - 'help' => t('Display the view as a block.'), - 'class' => 'Drupal\views\Plugins\views\display\Block', - 'theme' => 'views_view', - 'uses hook block' => TRUE, - 'contextual links locations' => array('block'), - 'use ajax' => TRUE, - 'use pager' => TRUE, - 'use more' => TRUE, - 'accept attachments' => TRUE, - 'admin' => t('Block'), - 'help topic' => 'display-block', - ), - 'attachment' => array( - 'title' => t('Attachment'), - 'help' => t('Attachments added to other displays to achieve multiple views in the same view.'), - 'class' => 'Drupal\views\Plugins\views\display\Attachment', - 'theme' => 'views_view', - 'contextual links locations' => array(), - 'use ajax' => TRUE, - 'use pager' => FALSE, - 'use more' => TRUE, - 'accept attachments' => FALSE, - 'help topic' => 'display-attachment', - ), - 'feed' => array( - 'title' => t('Feed'), - 'help' => t('Display the view as a feed, such as an RSS feed.'), - 'class' => 'Drupal\views\Plugins\views\display\Feed', - 'uses hook menu' => TRUE, - 'use ajax' => FALSE, - 'use pager' => FALSE, - 'accept attachments' => FALSE, - 'admin' => t('Feed'), - 'help topic' => 'display-feed', - ), - 'embed' => array( - 'title' => t('Embed'), - 'help' => t('Provide a display which can be embedded using the views api.'), - 'class' => 'Drupal\views\Plugins\views\display\Embed', - 'theme' => 'views_view', - 'uses hook menu' => FALSE, - 'use ajax' => TRUE, - 'use pager' => TRUE, - 'accept attachments' => FALSE, - 'admin' => t('Embed'), - 'no ui' => !config('views.settings')->get('views_ui_display_embed'), - ), - ), - 'display_extender' => array( - // Default settings for all display_extender plugins. - 'default' => array( - 'title' => t('Empty display extender'), - 'help' => t('Default settings for this view.'), - 'class' => 'Drupal\views\Plugins\views\display_extender\DisplayExtenderPluginBase', - // You can force the plugin to be enabled - 'enabled' => FALSE, - 'no ui' => TRUE, - ), - ), - 'style' => array( - // Default settings for all style plugins. - 'default' => array( - 'title' => t('Unformatted list'), - 'help' => t('Displays rows one after another.'), - 'class' => 'Drupal\views\Plugins\views\style\DefaultStyle', - 'theme' => 'views_view_unformatted', - 'uses row plugin' => TRUE, - 'uses row class' => TRUE, - 'uses grouping' => TRUE, - 'uses options' => TRUE, - 'type' => 'normal', - 'help topic' => 'style-unformatted', - ), - 'list' => array( - 'title' => t('HTML list'), - 'help' => t('Displays rows as an HTML list.'), - 'class' => 'Drupal\views\Plugins\views\style\List', - 'theme' => 'views_view_list', - 'uses row plugin' => TRUE, - 'uses row class' => TRUE, - 'uses options' => TRUE, - 'type' => 'normal', - 'help topic' => 'style-list', - ), - 'grid' => array( - 'title' => t('Grid'), - 'help' => t('Displays rows in a grid.'), - 'class' => 'Drupal\views\Plugins\views\style\Grid', - 'theme' => 'views_view_grid', - 'uses fields' => FALSE, - 'uses row plugin' => TRUE, - 'uses row class' => TRUE, - 'uses options' => TRUE, - 'type' => 'normal', - 'help topic' => 'style-grid', - ), - 'table' => array( - 'title' => t('Table'), - 'help' => t('Displays rows in a table.'), - 'class' => 'Drupal\views\Plugins\views\style\Table', - 'theme' => 'views_view_table', - 'uses row plugin' => FALSE, - 'uses row class' => TRUE, - 'uses fields' => TRUE, - 'uses options' => TRUE, - 'type' => 'normal', - 'help topic' => 'style-table', - ), - 'default_summary' => array( - 'title' => t('List'), - 'help' => t('Displays the default summary as a list.'), - 'class' => 'Drupal\views\Plugins\views\style\StyleSummaryPluginBase', - 'theme' => 'views_view_summary', - 'type' => 'summary', // only shows up as a summary style - 'uses options' => TRUE, - 'help topic' => 'style-summary', - ), - 'unformatted_summary' => array( - 'title' => t('Unformatted'), - 'help' => t('Displays the summary unformatted, with option for one after another or inline.'), - 'class' => 'Drupal\views\Plugins\views\style\UnformattedSummary', - 'theme' => 'views_view_summary_unformatted', - 'type' => 'summary', // only shows up as a summary style - 'uses options' => TRUE, - 'help topic' => 'style-summary-unformatted', - ), - 'rss' => array( - 'title' => t('RSS Feed'), - 'help' => t('Generates an RSS feed from a view.'), - 'class' => 'Drupal\views\Plugins\views\style\Rss', - 'theme' => 'views_view_rss', - 'uses row plugin' => TRUE, - 'uses options' => TRUE, - 'type' => 'feed', - 'help topic' => 'style-rss', - ), - ), - 'row' => array( - 'fields' => array( - 'title' => t('Fields'), - 'help' => t('Displays the fields with an optional template.'), - 'class' => 'Drupal\views\Plugins\views\row\Fields', - 'theme' => 'views_view_fields', - 'uses fields' => TRUE, - 'uses options' => TRUE, - 'type' => 'normal', - 'help topic' => 'style-row-fields', - ), - 'rss_fields' => array( - 'title' => t('Fields'), - 'help' => t('Display fields as RSS items.'), - 'class' => 'Drupal\views\Plugins\views\row\RssFields', - 'theme' => 'views_view_row_rss', - 'uses fields' => TRUE, - 'uses options' => TRUE, - 'type' => 'feed', - 'help topic' => 'style-row-fields', - ), - ), - 'argument default' => array( - 'parent' => array( - 'no ui' => TRUE, - 'class' => 'Drupal\views\Plugins\views\argument_default\ArgumentDefaultPluginBase', - 'parent' => '', - ), - 'fixed' => array( - 'title' => t('Fixed value'), - 'class' => 'Drupal\views\Plugins\views\argument_default\Fixed', - ), - 'php' => array( - 'title' => t('PHP Code'), - 'class' => 'Drupal\views\Plugins\views\argument_default\Fixed', - ), - 'raw' => array( - 'title' => t('Raw value from URL'), - 'class' => 'Drupal\views\Plugins\views\argument_default\Raw', - ), - ), - 'argument validator' => array( - 'php' => array( - 'title' => t('PHP Code'), - 'class' => 'Drupal\views\Plugins\views\argument_validator\Php', - ), - 'numeric' => array( - 'title' => t('Numeric'), - 'class' => 'Drupal\views\Plugins\views\argument_validator\Numeric', - ), - ), - 'access' => array( - 'none' => array( - 'title' => t('None'), - 'help' => t('Will be available to all users.'), - 'class' => 'Drupal\views\Plugins\views\access\None', - 'help topic' => 'access-none', - ), - 'role' => array( - 'title' => t('Role'), - 'help' => t('Access will be granted to users with any of the specified roles.'), - 'class' => 'Drupal\views\Plugins\views\access\Role', - 'uses options' => TRUE, - 'help topic' => 'access-role', - ), - 'perm' => array( - 'title' => t('Permission'), - 'help' => t('Access will be granted to users with the specified permission string.'), - 'class' => 'Drupal\views\Plugins\views\access\Permission', - 'uses options' => TRUE, - 'help topic' => 'access-perm', - ), - ), - 'query' => array( - 'parent' => array( - 'no ui' => TRUE, - 'class' => 'Drupal\views\Plugins\views\query\QueryPlugin', - 'parent' => '', - ), - 'views_query' => array( - 'title' => t('SQL Query'), - 'help' => t('Query will be generated and run using the Drupal database API.'), - 'class' => 'views_plugin_query_default', - 'class' => 'Drupal\views\Plugins\views\query\Sql', - ), - ), - 'cache' => array( - 'parent' => array( - 'no ui' => TRUE, - 'class' => 'Drupal\views\Plugins\views\cache\CachePluginBase', - 'parent' => '', - ), - 'none' => array( - 'title' => t('None'), - 'help' => t('No caching of Views data.'), - 'class' => 'Drupal\views\Plugins\views\cache\None', - 'help topic' => 'cache-none', - ), - 'time' => array( - 'title' => t('Time-based'), - 'help' => t('Simple time-based caching of data.'), - 'class' => 'Drupal\views\Plugins\views\cache\Time', - 'uses options' => TRUE, - 'help topic' => 'cache-time', - ), - ), - 'exposed_form' => array( - 'parent' => array( - 'no ui' => TRUE, - 'class' => 'Drupal\views\Plugins\views\exposed_form\ExposedFormPluginBase', - 'parent' => '', - ), - 'basic' => array( - 'title' => t('Basic'), - 'help' => t('Basic exposed form'), - 'class' => 'Drupal\views\Plugins\views\exposed_form\Basic', - 'uses options' => TRUE, - 'help topic' => 'exposed-form-basic', - ), - 'input_required' => array( - 'title' => t('Input required'), - 'help' => t('An exposed form that only renders a view if the form contains user input.'), - 'class' => 'Drupal\views\Plugins\views\exposed_form\InputRequired', - 'uses options' => TRUE, - 'help topic' => 'exposed-form-input-required', - ), - ), - 'pager' => array( - 'parent' => array( - 'no ui' => TRUE, - 'class' => 'Drupal\views\Plugins\views\pager\PagerPluginBase', - 'parent' => '', - ), - 'none' => array( - 'title' => t('Display all items'), - 'help' => t("Display all items that this view might find"), - 'class' => 'Drupal\views\Plugins\views\pager\None', - 'help topic' => 'pager-none', - 'uses options' => TRUE, - 'type' => 'basic', - ), - 'some' => array( - 'title' => t('Display a specified number of items'), - 'help' => t('Display a limited number items that this view might find.'), - 'class' => 'Drupal\views\Plugins\views\pager\Some', - 'help topic' => 'pager-some', - 'uses options' => TRUE, - 'type' => 'basic', - ), - 'full' => array( - 'title' => t('Paged output, full pager'), - 'short title' => t('Full'), - 'help' => t('Paged output, full Drupal style'), - 'class' => 'Drupal\views\Plugins\views\pager\Full', - 'help topic' => 'pager-full', - 'uses options' => TRUE, - ), - 'mini' => array( - 'title' => t('Paged output, mini pager'), - 'short title' => t('Mini'), - 'help' => t('Use the mini pager output.'), - 'class' => 'Drupal\views\Plugins\views\pager\Mini', - 'help topic' => 'pager-mini', - 'uses options' => TRUE, - 'parent' => 'full', - ), - ), - 'localization' => array( - 'parent' => array( - 'no ui' => TRUE, - 'class' => 'Drupal\views\Plugins\views\localization\LocalizationPluginBase', - 'parent' => '', - ), - 'none' => array( - 'title' => t('None'), - 'help' => t('Do not pass admin strings for translation.'), - 'class' => 'Drupal\views\Plugins\views\localization\None', - 'help topic' => 'localization-none', - ), - 'core' => array( - 'title' => t('Core'), - 'help' => t("Use Drupal core t() function. Not recommended, as it doesn't support updates to existing strings."), - 'class' => 'Drupal\views\Plugins\views\localization\Core', - 'help topic' => 'localization-core', - ), - ), - ); - // Add a help message pointing to the i18views module if it is not present. - if (!module_exists('i18nviews')) { - $plugins['localization']['core']['help'] .= ' ' . t('If you need to translate Views labels into other languages, consider installing the Internationalization package\'s Views translation module.', array('!path' => url('http://drupal.org/project/i18n', array('absolute' => TRUE)))); - } - - if (module_invoke('ctools', 'api_version', '1.3')) { - $plugins['style']['jump_menu_summary'] = array( - 'title' => t('Jump menu'), - 'help' => t('Puts all of the results into a select box and allows the user to go to a different page based upon the results.'), - 'class' => 'Drupal\views\Plugins\views\style\JumpMenuSummary', - 'theme' => 'views_view_summary_jump_menu', - 'type' => 'summary', // only shows up as a summary style - 'uses options' => TRUE, - 'help topic' => 'style-summary-jump-menu', - ); - $plugins['style']['jump_menu'] = array( - 'title' => t('Jump menu'), - 'help' => t('Puts all of the results into a select box and allows the user to go to a different page based upon the results.'), - 'class' => 'Drupal\views\Plugins\views\style\JumpMenu', - 'theme' => 'views_view_jump_menu', - 'uses row plugin' => TRUE, - 'uses fields' => TRUE, - 'uses options' => TRUE, - 'type' => 'normal', - 'help topic' => 'style-jump-menu', - ); - } - - return $plugins; -} - /** * Builds and return a list of all plugins available in the system. * @@ -565,22 +169,9 @@ function summary_title() { * This appears on the ui beside each plugin and beside the settings link. */ function plugin_title() { - if (isset($this->definition['short title'])) { - return check_plain($this->definition['short title']); + if (isset($this->definition['short_title'])) { + return check_plain($this->definition['short_title']); } return check_plain($this->definition['title']); } } - -/** - * Get enabled display extenders. - */ -function views_get_enabled_display_extenders() { - $enabled = array_filter((array) config('views.settings')->get('views_display_extenders')); - $options = views_fetch_plugin_names('display_extender'); - foreach ($options as $name => $plugin) { - $enabled[$name] = $name; - } - - return $enabled; -} diff --git a/lib/Drupal/views/Plugins/Type/AccessPluginManager.php b/lib/Drupal/views/Plugins/Type/AccessPluginManager.php index 340e8b199b4050dd03090da1b3429d0a3cf8e708..01f28ac5fe94b90a95fefd04b162b7fee72c21a9 100644 --- a/lib/Drupal/views/Plugins/Type/AccessPluginManager.php +++ b/lib/Drupal/views/Plugins/Type/AccessPluginManager.php @@ -10,10 +10,11 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\views\Plugins\Discovery\ViewsDiscovery; +use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; class AccessPluginManager extends PluginManagerBase { public function __construct() { - $this->discovery = new ViewsDiscovery('views_plugins', 'access'); + $this->discovery = new AnnotatedClassDiscovery('views', 'access'); $this->factory = new DefaultFactory($this); } } diff --git a/lib/Drupal/views/Plugins/Type/ArgumentValidatorPluginManager.php b/lib/Drupal/views/Plugins/Type/ArgumentValidatorPluginManager.php index 518e81161fe9e1351ede4eb8fd3f8f57ae5d8695..bbad7df0870730f7267492f7d2199ca3ffd46c5c 100644 --- a/lib/Drupal/views/Plugins/Type/ArgumentValidatorPluginManager.php +++ b/lib/Drupal/views/Plugins/Type/ArgumentValidatorPluginManager.php @@ -10,10 +10,11 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\views\Plugins\Discovery\ViewsDiscovery; +use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; class ArgumentValidatorPluginManager extends PluginManagerBase { public function __construct() { - $this->discovery = new ViewsDiscovery('views_plugins', 'argument validator'); + $this->discovery = new AnnotatedClassDiscovery('views', 'argument_validator'); $this->factory = new DefaultFactory($this); } } diff --git a/lib/Drupal/views/Plugins/Type/CachePluginManager.php b/lib/Drupal/views/Plugins/Type/CachePluginManager.php index 36a83e0746f5561ee1633a261df172ffb2389455..03eeb38b83efaa5a60e3dc030d41f14541b82de5 100644 --- a/lib/Drupal/views/Plugins/Type/CachePluginManager.php +++ b/lib/Drupal/views/Plugins/Type/CachePluginManager.php @@ -9,11 +9,12 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; -use Drupal\views\Plugins\views\Discovery\ViewsDiscovery; +use Drupal\views\Plugins\Discovery\ViewsDiscovery; +use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; class CachePluginManager extends PluginManagerBase { public function __construct() { - $this->discovery = new ViewsDiscovery('views_plugins', 'cache'); + $this->discovery = new AnnotatedClassDiscovery('views', 'cache'); $this->factory = new DefaultFactory($this); } } diff --git a/lib/Drupal/views/Plugins/Type/DisplayExtenderPluginManager.php b/lib/Drupal/views/Plugins/Type/DisplayExtenderPluginManager.php index ff0f131fcf1ba3097ba666efbeff7b2cc783e083..0b9fc1cb021174f59a0d80d4604757f204fbcded 100644 --- a/lib/Drupal/views/Plugins/Type/DisplayExtenderPluginManager.php +++ b/lib/Drupal/views/Plugins/Type/DisplayExtenderPluginManager.php @@ -9,11 +9,11 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; -use Drupal\views\Plugins\views\Discovery\ViewsDiscovery; +use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; -class DisplayPluginManager extends PluginManagerBase { +class DisplayExtenderPluginManager extends PluginManagerBase { public function __construct() { - $this->discovery = new ViewsDiscovery('views_plugins', 'display_extender'); + $this->discovery = new AnnotatedClassDiscovery('views', 'display_extender'); $this->factory = new DefaultFactory($this); } } diff --git a/lib/Drupal/views/Plugins/Type/DisplayPluginManager.php b/lib/Drupal/views/Plugins/Type/DisplayPluginManager.php index 1318e8d17e8e85df7cd54f489b3cf4d32d90a87e..efe69377f841b433ef9565feae8737b7fcfb8435 100644 --- a/lib/Drupal/views/Plugins/Type/DisplayPluginManager.php +++ b/lib/Drupal/views/Plugins/Type/DisplayPluginManager.php @@ -9,11 +9,12 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; -use Drupal\views\Plugins\Discovery\ViewsDiscovery; +use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; + class DisplayPluginManager extends PluginManagerBase { public function __construct() { - $this->discovery = new ViewsDiscovery('views_plugins', 'display'); + $this->discovery = new AnnotatedClassDiscovery('views', 'display'); $this->factory = new DefaultFactory($this); } } diff --git a/lib/Drupal/views/Plugins/Type/ExposedFormPluginManager.php b/lib/Drupal/views/Plugins/Type/ExposedFormPluginManager.php index 5761cb8c425d34bb5d940cdbc624d65781266e3b..dae62b9892926778519fa74538d642c4d5c19694 100644 --- a/lib/Drupal/views/Plugins/Type/ExposedFormPluginManager.php +++ b/lib/Drupal/views/Plugins/Type/ExposedFormPluginManager.php @@ -9,11 +9,12 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; -use Drupal\views\Plugins\Discovery\ViewsDiscovery; +use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; + class ExposedFormPluginManager extends PluginManagerBase { public function __construct() { - $this->discovery = new ViewsDiscovery('views_plugins', 'exposed_form'); + $this->discovery = new AnnotatedClassDiscovery('views', 'exposed_form'); $this->factory = new DefaultFactory($this); } } diff --git a/lib/Drupal/views/Plugins/Type/LocalizationPluginManager.php b/lib/Drupal/views/Plugins/Type/LocalizationPluginManager.php index 98f03360e12dd74e14dbc8adac063d21154be056..bed4066ece1b2f5f5373aec487ff309e0d042432 100644 --- a/lib/Drupal/views/Plugins/Type/LocalizationPluginManager.php +++ b/lib/Drupal/views/Plugins/Type/LocalizationPluginManager.php @@ -9,11 +9,12 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; -use Drupal\views\Plugins\Discovery\ViewsDiscovery; +use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; + class LocalizationPluginManager extends PluginManagerBase { public function __construct() { - $this->discovery = new ViewsDiscovery('views_plugins', 'localization'); + $this->discovery = new AnnotatedClassDiscovery('views', 'localization'); $this->factory = new DefaultFactory($this); } } diff --git a/lib/Drupal/views/Plugins/Type/PagerPluginManager.php b/lib/Drupal/views/Plugins/Type/PagerPluginManager.php index 053a425be09a793d030fe3ec233d2d602552015f..a276f295b16becb477f319617b0d8ad863cf8699 100644 --- a/lib/Drupal/views/Plugins/Type/PagerPluginManager.php +++ b/lib/Drupal/views/Plugins/Type/PagerPluginManager.php @@ -9,11 +9,12 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; -use Drupal\views\Plugins\Discovery\ViewsDiscovery; +use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; + class PagerPluginManager extends PluginManagerBase { public function __construct() { - $this->discovery = new ViewsDiscovery('views_plugins', 'pager'); + $this->discovery = new AnnotatedClassDiscovery('views', 'pager'); $this->factory = new DefaultFactory($this); } } diff --git a/lib/Drupal/views/Plugins/Type/QueryPluginManager.php b/lib/Drupal/views/Plugins/Type/QueryPluginManager.php index 11579863bc5caa2c0492c47dfda6571c3182eaf4..52b1e93a5c912321ef86db1a64ad3fb7a605b61f 100644 --- a/lib/Drupal/views/Plugins/Type/QueryPluginManager.php +++ b/lib/Drupal/views/Plugins/Type/QueryPluginManager.php @@ -9,11 +9,11 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; -use Drupal\views\Plugins\Discovery\ViewsDiscovery; +use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; class QueryPluginManager extends PluginManagerBase { public function __construct() { - $this->discovery = new ViewsDiscovery('views_plugins', 'query'); + $this->discovery = new AnnotatedClassDiscovery('views', 'query'); $this->factory = new DefaultFactory($this); } } diff --git a/lib/Drupal/views/Plugins/Type/RowPluginManager.php b/lib/Drupal/views/Plugins/Type/RowPluginManager.php index e98cadf40493fd418ddd6b45c13834ab0e7ce3b3..2b66cb3e75e2f376b72593e4191b0753fe4d5dcc 100644 --- a/lib/Drupal/views/Plugins/Type/RowPluginManager.php +++ b/lib/Drupal/views/Plugins/Type/RowPluginManager.php @@ -9,11 +9,11 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; -use Drupal\views\Plugins\Discovery\ViewsDiscovery; +use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; class RowPluginManager extends PluginManagerBase { public function __construct() { - $this->discovery = new ViewsDiscovery('views_plugins', 'row'); + $this->discovery = new AnnotatedClassDiscovery('views', 'row'); $this->factory = new DefaultFactory($this); } } diff --git a/lib/Drupal/views/Plugins/Type/StylePluginManager.php b/lib/Drupal/views/Plugins/Type/StylePluginManager.php index 103b1f9a45acc03c5258c173b25d3ec5d7538770..a61b3e3d0a798bdf735dce450c14c19817c6996e 100644 --- a/lib/Drupal/views/Plugins/Type/StylePluginManager.php +++ b/lib/Drupal/views/Plugins/Type/StylePluginManager.php @@ -9,11 +9,11 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; -use Drupal\views\Plugins\Discovery\ViewsDiscovery; +use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; class StylePluginManager extends PluginManagerBase { public function __construct() { - $this->discovery = new ViewsDiscovery('views_plugins', 'style'); + $this->discovery = new AnnotatedClassDiscovery('views', 'style'); $this->factory = new DefaultFactory($this); } } diff --git a/lib/Drupal/views/Plugins/Type/WizardManager.php b/lib/Drupal/views/Plugins/Type/WizardManager.php index 15bed32d2479dde765c966ef4948926063c16da7..f04e93bfca2f8dedad8b620f858493e3a4acd629 100644 --- a/lib/Drupal/views/Plugins/Type/WizardManager.php +++ b/lib/Drupal/views/Plugins/Type/WizardManager.php @@ -9,11 +9,11 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Plugin\Factory\DefaultFactory; -use Drupal\views\Plugins\Discovery\WizardDiscovery; +use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; class WizardManager extends PluginManagerBase { public function __construct() { - $this->discovery = new WizardDiscovery('views_wizard'); + $this->discovery = new AnnotatedClassDiscovery('views', 'wizard'); $this->factory = new DefaultFactory($this->discovery); } } diff --git a/lib/Drupal/views/Plugins/views/Plugin.php b/lib/Drupal/views/Plugins/views/Plugin.php index 60a9c9a7aa0e23cb81af8fccc7574780045c2dd5..50bb553bfa3a440190a1f286c069fec6ac5e9aed 100644 --- a/lib/Drupal/views/Plugins/views/Plugin.php +++ b/lib/Drupal/views/Plugins/views/Plugin.php @@ -434,8 +434,8 @@ function summary_title() { * This appears on the ui beside each plugin and beside the settings link. */ function plugin_title() { - if (isset($this->definition['short title'])) { - return check_plain($this->definition['short title']); + if (isset($this->definition['short_title'])) { + return check_plain($this->definition['short_title']); } return check_plain($this->definition['title']); } diff --git a/lib/Drupal/views/Plugins/views/access/None.php b/lib/Drupal/views/Plugins/views/access/None.php index 4fb2709e9e63c2fc98408b0aaaee8ec36142de31..b9bdc4bfc64e9e29a069cdfd20b1d7dda3d8ca01 100644 --- a/lib/Drupal/views/Plugins/views/access/None.php +++ b/lib/Drupal/views/Plugins/views/access/None.php @@ -7,11 +7,23 @@ namespace Drupal\views\Plugins\views\access; +use Drupal\Core\Annotation\Translation; +use Drupal\Core\Annotation\Plugin; + /** * Access plugin that provides no access control at all. * * @ingroup views_access_plugins */ + +/** + * @Plugin( + * plugin_id = "none", + * title = @Translation("None"), + * help = @Translation("Will be available to all users."), + * help_topic = "access-none" + * ) + */ class None extends AccessPluginBase { function summary_title() { return t('Unrestricted'); diff --git a/lib/Drupal/views/Plugins/views/access/Permission.php b/lib/Drupal/views/Plugins/views/access/Permission.php index ad1a15ab3e47796d08a8e9e034ea6ff888e6968c..60e0a8530791551a75700789ca9b5ddf8bba98a6 100644 --- a/lib/Drupal/views/Plugins/views/access/Permission.php +++ b/lib/Drupal/views/Plugins/views/access/Permission.php @@ -7,11 +7,24 @@ namespace Drupal\views\Plugins\views\access; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Access plugin that provides permission-based access control. * * @ingroup views_access_plugins */ + +/** + * @Plugin( + * plugin_id = "permission", + * title = @Translation("Permission"), + * help = @Translation("Access will be granted to users with the specified permission string."), + * help_topic = "access-perm", + * uses_options = TRUE + * ) + */ class Permission extends AccessPluginBase { function access($account) { return views_check_perm($this->options['perm'], $account); diff --git a/lib/Drupal/views/Plugins/views/access/Role.php b/lib/Drupal/views/Plugins/views/access/Role.php index 2798d393a544ba1fb659cbc66b988a351a230e04..5df5e23d20f471b029b237ccad7ce1dd77f35ec8 100644 --- a/lib/Drupal/views/Plugins/views/access/Role.php +++ b/lib/Drupal/views/Plugins/views/access/Role.php @@ -7,11 +7,24 @@ namespace Drupal\views\Plugins\views\access; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Access plugin that provides role-based access control. * * @ingroup views_access_plugins */ + +/** + * @Plugin( + * plugin_id = "role", + * title = @Translation("Role"), + * help = @Translation("Access will be granted to users with any of the specified roles."), + * help_topic = "access-role", + * uses_options = TRUE + * ) + */ class Role extends AccessPluginBase { function access($account) { return views_check_roles(array_filter($this->options['role']), $account); diff --git a/lib/Drupal/views/Plugins/views/argument/ArgumentPluginBase.php b/lib/Drupal/views/Plugins/views/argument/ArgumentPluginBase.php index 41662bf28f6869d20483ad10232ee1d5c18edd80..318197541727057357fe0109386d8370235a47d8 100644 --- a/lib/Drupal/views/Plugins/views/argument/ArgumentPluginBase.php +++ b/lib/Drupal/views/Plugins/views/argument/ArgumentPluginBase.php @@ -367,7 +367,7 @@ function options_form(&$form, &$form_state) { $validate_types = array('none' => t('- Basic validation -')); $plugins = views_fetch_plugin_data('argument validator'); foreach ($plugins as $id => $info) { - if (!empty($info['no ui'])) { + if (!empty($info['no_ui'])) { continue; } @@ -588,7 +588,7 @@ function default_argument_form(&$form, &$form_state) { ); foreach ($plugins as $id => $info) { - if (!empty($info['no ui'])) { + if (!empty($info['no_ui'])) { continue; } $plugin = $this->get_plugin('argument default', $id); diff --git a/lib/Drupal/views/Plugins/views/argument_default/Fixed.php b/lib/Drupal/views/Plugins/views/argument_default/Fixed.php index a064b46e43b93cac0ba2bad423abfec9fc20df71..97b1394594a92a1cae6721a81abfb4058e516679 100644 --- a/lib/Drupal/views/Plugins/views/argument_default/Fixed.php +++ b/lib/Drupal/views/Plugins/views/argument_default/Fixed.php @@ -7,11 +7,21 @@ namespace Drupal\views\Plugins\views\argument_default; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * The fixed argument default handler. * * @ingroup views_argument_default_plugins */ + +/** + * @Plugin( + * plugin_id = "fixed", + * title = @Translation("Fixed"), + * ) + */ class Fixed extends ArgumentDefaultPluginBase { function option_definition() { $options = parent::option_definition(); diff --git a/lib/Drupal/views/Plugins/views/argument_default/Php.php b/lib/Drupal/views/Plugins/views/argument_default/Php.php index ec8bd3ba981cb849877aa4000bc90e6a54349b74..a72e69fbf2f0d05a771d9049a70bd37c117187ae 100644 --- a/lib/Drupal/views/Plugins/views/argument_default/Php.php +++ b/lib/Drupal/views/Plugins/views/argument_default/Php.php @@ -7,11 +7,21 @@ namespace Drupal\views\Plugins\views\argument_default; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Default argument plugin to provide a PHP code block. * * @ingroup views_argument_default_plugins */ + +/** + * @Plugin( + * plugin_id = "php", + * title = @Translation("PHP Code") + * ) + */ class Php extends ArgumentDefaultPluginBase { function option_definition() { $options = parent::option_definition(); diff --git a/lib/Drupal/views/Plugins/views/argument_default/Raw.php b/lib/Drupal/views/Plugins/views/argument_default/Raw.php index 5a9ea983a1e1894894a0882359cab3b12cace47b..c3208637656bdb5aa1578c3911f0a54909fd56b5 100644 --- a/lib/Drupal/views/Plugins/views/argument_default/Raw.php +++ b/lib/Drupal/views/Plugins/views/argument_default/Raw.php @@ -7,11 +7,21 @@ namespace Drupal\views\Plugins\views\argument_default; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Default argument plugin to use the raw value from the URL. * * @ingroup views_argument_default_plugins */ + +/** + * @Plugin( + * plugin_id = "raw", + * title = @Translation("Raw value from URL") + * ) + */ class Raw extends ArgumentDefaultPluginBase { function option_definition() { $options = parent::option_definition(); diff --git a/lib/Drupal/views/Plugins/views/argument_validator/Numeric.php b/lib/Drupal/views/Plugins/views/argument_validator/Numeric.php index b804a6f5df2f4058b51eeb8371bd8c0d4c5b20a3..e15b0ea0adf63a3147e05f38b9f6f020cd0b3caa 100644 --- a/lib/Drupal/views/Plugins/views/argument_validator/Numeric.php +++ b/lib/Drupal/views/Plugins/views/argument_validator/Numeric.php @@ -7,11 +7,21 @@ namespace Drupal\views\Plugins\views\argument_validator; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Validate whether an argument is numeric or not. * * @ingroup views_argument_validate_plugins */ + +/** + * @Plugin( + * plugin_id = "numeric", + * title = @Translation("Numeric"), + * ) + */ class Numeric extends ArgumentValidatorPluginBase { function validate_argument($argument) { return is_numeric($argument); diff --git a/lib/Drupal/views/Plugins/views/argument_validator/Php.php b/lib/Drupal/views/Plugins/views/argument_validator/Php.php index 7dec0c8699b57df89e90f9c0902ce3579fb5b2cf..133f6b0ef184ec01cbf1221362c10384a70bc013 100644 --- a/lib/Drupal/views/Plugins/views/argument_validator/Php.php +++ b/lib/Drupal/views/Plugins/views/argument_validator/Php.php @@ -7,11 +7,21 @@ namespace Drupal\views\Plugins\views\argument_validator; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Provide PHP code to validate whether or not an argument is ok. * * @ingroup views_argument_validate_plugins */ + +/** + * @Plugin( + * plugin_id = "php", + * title = @Translation("PHP Code"), + * ) + */ class Php extends ArgumentValidatorPluginBase { function option_definition() { $options = parent::option_definition(); diff --git a/lib/Drupal/views/Plugins/views/cache/None.php b/lib/Drupal/views/Plugins/views/cache/None.php index dddf7cf00e42d2b22cc3813387397c2d2d00ec18..076ac137fbc4663e3247002066ee6d34af9430dd 100644 --- a/lib/Drupal/views/Plugins/views/cache/None.php +++ b/lib/Drupal/views/Plugins/views/cache/None.php @@ -7,11 +7,23 @@ namespace Drupal\views\Plugins\views\cache; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Caching plugin that provides no caching at all. * * @ingroup views_cache_plugins */ + +/** + * @Plugin( + * plugin_id = "none", + * title = @Translation("None"), + * help = @Translation("No caching of Views data."), + * help_topic = "cache-none" + * ) + */ class None extends CachePluginBase { function cache_start() { /* do nothing */ } diff --git a/lib/Drupal/views/Plugins/views/cache/Time.php b/lib/Drupal/views/Plugins/views/cache/Time.php index e19d91dcc8685c0698421708fbece2f3d108601c..ac581b700fff021ce6ec5eaee596fc47ce8c127d 100644 --- a/lib/Drupal/views/Plugins/views/cache/Time.php +++ b/lib/Drupal/views/Plugins/views/cache/Time.php @@ -7,11 +7,24 @@ namespace Drupal\views\Plugins\views\cache; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Simple caching of query results for Views displays. * * @ingroup views_cache_plugins */ + +/** + * @Plugin( + * plugin_id = "time", + * title = @Translation("Time-based"), + * help = @Translation("Simple time-based caching of data."), + * help_topic = "cache-time", + * uses_options = TRUE + * ) + */ class Time extends CachePluginBase { function option_definition() { $options = parent::option_definition(); diff --git a/lib/Drupal/views/Plugins/views/display/Attachment.php b/lib/Drupal/views/Plugins/views/display/Attachment.php index 06b41989412b3eb0fe6fde6a493c0f83d6416d81..158e2918080a19736e5883ffa95a7121f6c81bd3 100644 --- a/lib/Drupal/views/Plugins/views/display/Attachment.php +++ b/lib/Drupal/views/Plugins/views/display/Attachment.php @@ -7,6 +7,9 @@ namespace Drupal\views\Plugins\views\display; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * The plugin that handles an attachment display. * @@ -16,6 +19,21 @@ * * @ingroup views_display_plugins */ + +/** + * @Plugin( + * plugin_id = "attachment", + * title = @Translation("Attachment"), + * help = @Translation("Attachments added to other displays to achieve multiple views in the same view."), + * theme = "views_view", + * contextual_links_locations = {""}, + * use_ajax = TRUE, + * use_pager = FALSE, + * use_more = TRUE, + * accept_attachments = FALSE, + * help_topic = "display-attachment" + * ) + */ class Attachment extends DisplayPluginBase { function option_definition() { $options = parent::option_definition(); diff --git a/lib/Drupal/views/Plugins/views/display/Block.php b/lib/Drupal/views/Plugins/views/display/Block.php index 473ba1a7ae230cd7205c793623a837b86edff29e..6d88e6bb46d796c0711019a74d1c45388e1bb50a 100644 --- a/lib/Drupal/views/Plugins/views/display/Block.php +++ b/lib/Drupal/views/Plugins/views/display/Block.php @@ -7,11 +7,31 @@ namespace Drupal\views\Plugins\views\display; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * The plugin that handles a block. * * @ingroup views_display_plugins */ + +/** + * @Plugin( + * plugin_id = "block", + * title = @Translation("Block"), + * help = @Translation("Display the view as a block."), + * theme = "views_view", + * uses_hook_block = TRUE, + * contextual_links_locations = {"block"}, + * use_ajax = TRUE, + * use_pager = TRUE, + * use_more = TRUE, + * accept_attachments = TRUE, + * admin = @Translation("Block"), + * help_topic = "display-block" + * ) + */ class Block extends DisplayPluginBase { function option_definition() { $options = parent::option_definition(); diff --git a/lib/Drupal/views/Plugins/views/display/DefaultDisplay.php b/lib/Drupal/views/Plugins/views/display/DefaultDisplay.php index 6843242cb1b7e6b03a821d40d66be757dd2dfcd2..fda0af931d7b48269674dd1fb99f2603e3613fa0 100644 --- a/lib/Drupal/views/Plugins/views/display/DefaultDisplay.php +++ b/lib/Drupal/views/Plugins/views/display/DefaultDisplay.php @@ -7,11 +7,30 @@ namespace Drupal\views\Plugins\views\display; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * A plugin to handle defaults on a view. * * @ingroup views_display_plugins */ + +/** + * @Plugin( + * plugin_id = "standard", + * title = @Translation("Master"), + * help = @Translation("Default settings for this view."), + * theme = "views_view", + * no_ui = TRUE, + * no_remove = TRUE, + * use_ajax = TRUE, + * use_pager = TRUE, + * use_more = TRUE, + * accept_attachments = TRUE, + * help_topic = "display-default" + * ) + */ class DefaultDisplay extends DisplayPluginBase { /** * Determine if this display is the 'default' display which contains diff --git a/lib/Drupal/views/Plugins/views/display/DisplayPluginBase.php b/lib/Drupal/views/Plugins/views/display/DisplayPluginBase.php index 7ce0cb6bd74ae9f822114cba0a273f795daea131..cca15942879aeab8b4e723af1a64612af3981ad5 100644 --- a/lib/Drupal/views/Plugins/views/display/DisplayPluginBase.php +++ b/lib/Drupal/views/Plugins/views/display/DisplayPluginBase.php @@ -58,8 +58,7 @@ function init(&$view, &$display, $options = NULL) { // Load extenders as soon as possible. $this->extender = array(); $extenders = views_get_enabled_display_extenders(); - // If you update to the dev version the registry might not be loaded yet. - if (!empty($extenders) && class_exists('views_plugin_display_extender')) { + if (!empty($extenders)) { foreach ($extenders as $extender) { $plugin = views_get_plugin('display_extender', $extender); if ($plugin) { @@ -390,10 +389,10 @@ function use_more_text() { } /** - * Can this display accept attachments? + * Can this display accept_attachments? */ function accept_attachments() { - if (empty($this->definition['accept attachments'])) { + if (empty($this->definition['accept_attachments'])) { return FALSE; } if (!empty($this->view->argument) && $this->get_option('hide_attachment_summary')) { @@ -1191,7 +1190,8 @@ function options_summary(&$categories, &$options) { 'desc' => t('Change the title that this display will use.'), ); - $style_plugin = views_fetch_plugin_data('style', $this->get_option('style_plugin')); + $manager = views_get_plugin_manager('style'); + $style_plugin = $manager->getDefinition($this->get_option('style_plugin')); $style_plugin_instance = $this->get_plugin('style'); $style_summary = empty($style_plugin['title']) ? t('Missing style plugin') : $style_plugin_instance->summary_title(); $style_title = empty($style_plugin['title']) ? t('Missing style plugin') : $style_plugin_instance->plugin_title(); @@ -1207,11 +1207,11 @@ function options_summary(&$categories, &$options) { ); // This adds a 'Settings' link to the style_options setting if the style has options. - if (!empty($style_plugin['uses options'])) { + if (!empty($style_plugin['uses_options'])) { $options['style_plugin']['links']['style_options'] = t('Change settings for this format'); } - if (!empty($style_plugin['uses row plugin'])) { + if (!empty($style_plugin['uses_row_plugin'])) { $row_plugin = views_fetch_plugin_data('row', $this->get_option('row_plugin')); $row_plugin_instance = $this->get_plugin('row'); $row_summary = empty($row_plugin['title']) ? t('Missing style plugin') : $row_plugin_instance->summary_title(); @@ -1225,7 +1225,7 @@ function options_summary(&$categories, &$options) { 'desc' => t('Change the way each row in the view is styled.'), ); // This adds a 'Settings' link to the row_options setting if the row style has options. - if (!empty($row_plugin['uses options'])) { + if (!empty($row_plugin['uses_options'])) { $options['row_plugin']['links']['row_options'] = t('Change settings for this style'); } } @@ -1237,7 +1237,7 @@ function options_summary(&$categories, &$options) { 'desc' => t('Change whether or not this display will use AJAX.'), ); } - if (!empty($this->definition['accept attachments'])) { + if (!empty($this->definition['accept_attachments'])) { $options['hide_attachment_summary'] = array( 'category' => 'other', 'title' => t('Hide attachments in summary'), @@ -1275,7 +1275,7 @@ function options_summary(&$categories, &$options) { $options['pager']['title'] = t('Items to display'); } - if (!empty($pager_plugin->definition['uses options'])) { + if (!empty($pager_plugin->definition['uses_options'])) { $options['pager']['links']['pager_options'] = t('Change settings for this pager type.'); } @@ -1337,7 +1337,7 @@ function options_summary(&$categories, &$options) { 'desc' => t('Specify access control type for this display.'), ); - if (!empty($access_plugin->definition['uses options'])) { + if (!empty($access_plugin->definition['uses_options'])) { $options['access']['links']['access_options'] = t('Change settings for this access type.'); } @@ -1357,11 +1357,11 @@ function options_summary(&$categories, &$options) { 'desc' => t('Specify caching type for this display.'), ); - if (!empty($cache_plugin->definition['uses options'])) { + if (!empty($cache_plugin->definition['uses_options'])) { $options['cache']['links']['cache_options'] = t('Change settings for this caching type.'); } - if (!empty($access_plugin->definition['uses options'])) { + if (!empty($access_plugin->definition['uses_options'])) { $options['access']['links']['access_options'] = t('Change settings for this access type.'); } @@ -1402,7 +1402,7 @@ function options_summary(&$categories, &$options) { 'desc' => t('Select the kind of exposed filter to use.'), ); - if (!empty($exposed_form_plugin->definition['uses options'])) { + if (!empty($exposed_form_plugin->definition['uses_options'])) { $options['exposed_form']['links']['exposed_form_options'] = t('Exposed form settings for this exposed form style.'); } @@ -1584,7 +1584,7 @@ function options_form(&$form, &$form_state) { ); $access_plugin = views_fetch_plugin_data('access', $access['type']); - if (!empty($access_plugin['uses options'])) { + if (!empty($access_plugin['uses_options'])) { $form['markup'] = array( '#prefix' => '
', '#markup' => t('You may also adjust the !settings for the currently selected access restriction.', array('!settings' => $this->option_link(t('settings'), 'access_options'))), @@ -1598,7 +1598,7 @@ function options_form(&$form, &$form_state) { $plugin = $this->get_plugin('access'); $form['#title'] .= t('Access options'); if ($plugin) { - $form['#help_topic'] = $plugin->definition['help topic']; + $form['#help_topic'] = $plugin->definition['help_topic']; $form['#help_module'] = $plugin->definition['module']; $form['access_options'] = array( @@ -1627,7 +1627,7 @@ function options_form(&$form, &$form_state) { ); $cache_plugin = views_fetch_plugin_data('cache', $cache['type']); - if (!empty($cache_plugin['uses options'])) { + if (!empty($cache_plugin['uses_options'])) { $form['markup'] = array( '#prefix' => '
', '#suffix' => '
', @@ -1660,8 +1660,8 @@ function options_form(&$form, &$form_state) { $form['#title'] .= t('Query options'); $this->view->init_query(); if ($this->view->query) { - if (isset($this->view->query->definition['help topic'])) { - $form['#help_topic'] = $this->view->query->definition['help topic']; + if (isset($this->view->query->definition['help_topic'])) { + $form['#help_topic'] = $this->view->query->definition['help_topic']; } if (isset($this->view->query->definition['module'])) { @@ -1725,6 +1725,7 @@ function options_form(&$form, &$form_state) { } break; case 'style_plugin': + $manager = views_get_plugin_manager('style'); $form['#title'] .= t('How should this view be styled'); $form['#help_topic'] = 'style'; $form['style_plugin'] = array( @@ -1734,8 +1735,8 @@ function options_form(&$form, &$form_state) { '#description' => t('If the style you choose has settings, be sure to click the settings button that will appear next to it in the View summary.'), ); - $style_plugin = views_fetch_plugin_data('style', $this->get_option('style_plugin')); - if (!empty($style_plugin['uses options'])) { + $style_plugin = $manager->getDefinition($this->get_option('style_plugin')); + if (!empty($style_plugin['uses_options'])) { $form['markup'] = array( '#markup' => '
' . t('You may also adjust the !settings for the currently selected style.', array('!settings' => $this->option_link(t('settings'), 'style_options'))) . '
', ); @@ -1759,8 +1760,8 @@ function options_form(&$form, &$form_state) { } $plugin = $this->get_plugin(empty($style) ? 'row' : 'style'); if ($plugin) { - if (isset($plugin->definition['help topic'])) { - $form['#help_topic'] = $plugin->definition['help topic']; + if (isset($plugin->definition['help_topic'])) { + $form['#help_topic'] = $plugin->definition['help_topic']; $form['#help_module'] = $plugin->definition['module']; } $form[$form_state['section']] = array( @@ -1779,7 +1780,7 @@ function options_form(&$form, &$form_state) { ); $row_plugin = views_fetch_plugin_data('row', $this->get_option('row_plugin')); - if (!empty($row_plugin['uses options'])) { + if (!empty($row_plugin['uses_options'])) { $form['markup'] = array( '#markup' => '
' . t('You may also adjust the !settings for the currently selected row style.', array('!settings' => $this->option_link(t('settings'), 'row_options'))) . '
', ); @@ -2134,7 +2135,7 @@ function options_form(&$form, &$form_state) { ); $exposed_form_plugin = views_fetch_plugin_data('exposed_form', $exposed_form['type']); - if (!empty($exposed_form_plugin['uses options'])) { + if (!empty($exposed_form_plugin['uses_options'])) { $form['markup'] = array( '#prefix' => '
', '#suffix' => '
', @@ -2146,7 +2147,7 @@ function options_form(&$form, &$form_state) { $plugin = $this->get_plugin('exposed_form'); $form['#title'] .= t('Exposed form options'); if ($plugin) { - $form['#help_topic'] = $plugin->definition['help topic']; + $form['#help_topic'] = $plugin->definition['help_topic']; $form['exposed_form_options'] = array( '#tree' => TRUE, @@ -2170,7 +2171,7 @@ function options_form(&$form, &$form_state) { ); $pager_plugin = views_fetch_plugin_data('pager', $pager['type'], array($this->view->base_table)); - if (!empty($pager_plugin['uses options'])) { + if (!empty($pager_plugin['uses_options'])) { $form['markup'] = array( '#prefix' => '
', '#suffix' => '
', @@ -2183,7 +2184,7 @@ function options_form(&$form, &$form_state) { $plugin = $this->get_plugin('pager'); $form['#title'] .= t('Pager options'); if ($plugin) { - $form['#help_topic'] = $plugin->definition['help topic']; + $form['#help_topic'] = $plugin->definition['help_topic']; $form['pager_options'] = array( '#tree' => TRUE, @@ -2329,7 +2330,7 @@ function options_submit(&$form, &$form_state) { if ($plugin) { $access = array('type' => $form_state['values']['access']['type']); $this->set_option('access', $access); - if (!empty($plugin->definition['uses options'])) { + if (!empty($plugin->definition['uses_options'])) { views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('access_options')); } } @@ -2350,7 +2351,7 @@ function options_submit(&$form, &$form_state) { if ($plugin) { $cache = array('type' => $form_state['values']['cache']['type']); $this->set_option('cache', $cache); - if (!empty($plugin->definition['uses options'])) { + if (!empty($plugin->definition['uses_options'])) { views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('cache_options')); } } @@ -2408,7 +2409,7 @@ function options_submit(&$form, &$form_state) { $this->set_option('row_options', array()); // send ajax form to options page if we use it. - if (!empty($plugin->definition['uses options'])) { + if (!empty($plugin->definition['uses_options'])) { views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('row_options')); } } @@ -2423,7 +2424,7 @@ function options_submit(&$form, &$form_state) { $this->set_option($section, $form_state['values'][$section]); $this->set_option('style_options', array()); // send ajax form to options page if we use it. - if (!empty($plugin->definition['uses options'])) { + if (!empty($plugin->definition['uses_options'])) { views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('style_options')); } } @@ -2449,7 +2450,7 @@ function options_submit(&$form, &$form_state) { if ($plugin) { $exposed_form = array('type' => $form_state['values']['exposed_form']['type'], 'options' => array()); $this->set_option('exposed_form', $exposed_form); - if (!empty($plugin->definition['uses options'])) { + if (!empty($plugin->definition['uses_options'])) { views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('exposed_form_options')); } } @@ -2476,7 +2477,7 @@ function options_submit(&$form, &$form_state) { $pager = array('type' => $form_state['values']['pager']['type'], 'options' => $plugin->options); $this->set_option('pager', $pager); - if (!empty($plugin->definition['uses options'])) { + if (!empty($plugin->definition['uses_options'])) { views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('pager_options')); } } diff --git a/lib/Drupal/views/Plugins/views/display/Embed.php b/lib/Drupal/views/Plugins/views/display/Embed.php index 74f169e4afbe87cb0dd54284c549dec5856643c7..ccb14ebd16963287c0d33b7560b161339ee2ecdd 100644 --- a/lib/Drupal/views/Plugins/views/display/Embed.php +++ b/lib/Drupal/views/Plugins/views/display/Embed.php @@ -7,10 +7,30 @@ namespace Drupal\views\Plugins\views\display; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * The plugin that handles an embed display. * * @ingroup views_display_plugins + * + * @todo: Wait until annotations/plugins support access mehtods. + * no ui => !config('views.settings')->get('views_ui_display_embed'), + */ + +/** + * @Plugin( + * plugin_id = "embed", + * title = @Translation("Embed"), + * help = @Translation("Provide a display which can be embedded using the views api."), + * theme = "views_view", + * uses_hook_menu = FALSE, + * use_ajax = TRUE, + * use_pager = TRUE, + * accept_attachments = FALSE, + * help_topic = "display-embed" + * ) */ class Embed extends DisplayPluginBase { // This display plugin does nothing apart from exist. diff --git a/lib/Drupal/views/Plugins/views/display/Feed.php b/lib/Drupal/views/Plugins/views/display/Feed.php index 178eb7bf59881c3f611d2675cc4f6bf96407228d..021f963ed786798da821ba0d823aaaa97d700598 100644 --- a/lib/Drupal/views/Plugins/views/display/Feed.php +++ b/lib/Drupal/views/Plugins/views/display/Feed.php @@ -8,6 +8,8 @@ namespace Drupal\views\Plugins\views\display; use Symfony\Component\HttpFoundation\Response; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; /** * The plugin that handles a feed, such as RSS or atom. @@ -16,6 +18,20 @@ * * @ingroup views_display_plugins */ + +/** + * @Plugin( + * plugin_id = "feed", + * title = @Translation("Feed"), + * help = @Translation("Display the view as a feed, such as an RSS feed."), + * uses_hook_menu = TRUE, + * use_ajax = FALSE, + * use_pager = FALSE, + * accept_attachments = FALSE, + * admin = @Translation("Feed"), + * help_topic = "display-feed" + * ) + */ class Feed extends Page { function init(&$view, &$display, $options = NULL) { parent::init($view, $display, $options); diff --git a/lib/Drupal/views/Plugins/views/display/Page.php b/lib/Drupal/views/Plugins/views/display/Page.php index e13c0356a0d3b5b3ae3d4c7b50f075cf1b17b2d7..d94e94ad7a83f8c53971faae36c41a6ff596bd12 100644 --- a/lib/Drupal/views/Plugins/views/display/Page.php +++ b/lib/Drupal/views/Plugins/views/display/Page.php @@ -7,11 +7,31 @@ namespace Drupal\views\Plugins\views\display; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * The plugin that handles a full page. * * @ingroup views_display_plugins */ + +/** + * @Plugin( + * plugin_id = "page", + * title = @Translation("Page"), + * help = @Translation("Display the view as a page, with a URL and menu links."), + * uses_hook_menu = TRUE, + * contextual_links_locations = {"page"}, + * theme = "views_view", + * use_ajax = TRUE, + * use_pager = TRUE, + * use_more = TRUE, + * accept_attachments = TRUE, + * admin = @Translation("Page"), + * help_topic = "display-page" + * ) + */ class Page extends DisplayPluginBase { /** * The page display has a path. diff --git a/lib/Drupal/views/Plugins/views/display_extender/DefaultDisplayExtender.php b/lib/Drupal/views/Plugins/views/display_extender/DefaultDisplayExtender.php new file mode 100644 index 0000000000000000000000000000000000000000..5dd3be2c275141fb7f5e97aaf83572736721bba2 --- /dev/null +++ b/lib/Drupal/views/Plugins/views/display_extender/DefaultDisplayExtender.php @@ -0,0 +1,18 @@ +view = $view; $this->display = $display; diff --git a/lib/Drupal/views/Plugins/views/exposed_form/Basic.php b/lib/Drupal/views/Plugins/views/exposed_form/Basic.php index 267287d634993f3c4eb88d94e0c9bbcd962459b1..526a0a3f82ca08c81816b4b70d15b1ca2481edba 100644 --- a/lib/Drupal/views/Plugins/views/exposed_form/Basic.php +++ b/lib/Drupal/views/Plugins/views/exposed_form/Basic.php @@ -7,9 +7,22 @@ namespace Drupal\views\Plugins\views\exposed_form; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Exposed form plugin that provides a basic exposed form. * * @ingroup views_exposed_form_plugins */ + +/** + * @Plugin( + * plugin_id = "basic", + * title = @Translation("Basic"), + * help = @Translation("Basic exposed form"), + * uses_options = TRUE, + * help_topic = "exposed-form-basic" + * ) + */ class Basic extends ExposedFormPluginBase { } diff --git a/lib/Drupal/views/Plugins/views/exposed_form/InputRequired.php b/lib/Drupal/views/Plugins/views/exposed_form/InputRequired.php index 83fbf10a2c03ae943182fae296abbcbed8d30a10..3ba1932d7037581e031d258db76cb9dca2d8bfa2 100644 --- a/lib/Drupal/views/Plugins/views/exposed_form/InputRequired.php +++ b/lib/Drupal/views/Plugins/views/exposed_form/InputRequired.php @@ -7,11 +7,24 @@ namespace Drupal\views\Plugins\views\exposed_form; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Exposed form plugin that provides an exposed form with required input. * * @ingroup views_exposed_form_plugins */ + +/** + * @Plugin( + * plugin_id = "input_required", + * title = @Translation("Input required"), + * help = @Translation("An exposed form that only renders a view if the form contains user input."), + * uses_options = TRUE, + * help_topic = "exposed-form-input-required" + * ) + */ class InputRequired extends ExposedFormPluginBase { function option_definition() { diff --git a/lib/Drupal/views/Plugins/views/filter/BooleanOperatorString.php b/lib/Drupal/views/Plugins/views/filter/BooleanOperatorString.php index 1d6a7ed9eba546c5c74716bc77f4c1e2133b6f84..6d752c317ed20068f2157128783095f9280f898a 100644 --- a/lib/Drupal/views/Plugins/views/filter/BooleanOperatorString.php +++ b/lib/Drupal/views/Plugins/views/filter/BooleanOperatorString.php @@ -22,8 +22,8 @@ */ /** - * @plugin( - * plugid_id = "boolean_string" + * @Plugin( + * plugin_id = "boolean_string" * ) */ class BooleanOperatorString extends BooleanOperator { diff --git a/lib/Drupal/views/Plugins/views/localization/Core.php b/lib/Drupal/views/Plugins/views/localization/Core.php index b567d908ba79c5794dcd592aff9ea1b354363261..514940e33e526e4b7b732e5e3154480caeedaf12 100644 --- a/lib/Drupal/views/Plugins/views/localization/Core.php +++ b/lib/Drupal/views/Plugins/views/localization/Core.php @@ -7,11 +7,23 @@ namespace Drupal\views\Plugins\views\localization; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Localization plugin to pass translatable strings through t(). * * @ingroup views_localization_plugins */ + +/** + * @Plugin( + * plugin_id = "core", + * title = @Translation("Core"), + * help = @Translation("Use Drupal core t() function. Not recommended, as it doesn't support updates to existing strings."), + * help_topic = "localization-core" + * ) + */ class Core extends LocalizationPluginBase { /** diff --git a/lib/Drupal/views/Plugins/views/localization/None.php b/lib/Drupal/views/Plugins/views/localization/None.php index 0a344f2bc98c8aac5aacb5a479ea040496ed3248..d6cd5569fa28e52f48cd08009bbf007b6a3d2b7e 100644 --- a/lib/Drupal/views/Plugins/views/localization/None.php +++ b/lib/Drupal/views/Plugins/views/localization/None.php @@ -7,11 +7,23 @@ namespace Drupal\views\Plugins\views\localization; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Localization plugin for no localization. * * @ingroup views_localization_plugins */ + +/** + * @Plugin( + * plugin_id = "none", + * title = @Translation("None"), + * help = @Translation("Do not pass admin strings for translation."), + * help_topic = "localization-none" + * ) + */ class None extends LocalizationPluginBase { var $translate = FALSE; diff --git a/lib/Drupal/views/Plugins/views/pager/Full.php b/lib/Drupal/views/Plugins/views/pager/Full.php index be2250ed6f95bfe11ce5eddc696a96a722856588..7946bdd6a78b48fcd37883dcdc42f3d9396abf7c 100644 --- a/lib/Drupal/views/Plugins/views/pager/Full.php +++ b/lib/Drupal/views/Plugins/views/pager/Full.php @@ -7,11 +7,25 @@ namespace Drupal\views\Plugins\views\pager; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * The plugin to handle full pager. * * @ingroup views_pager_plugins */ + +/** + * @Plugin( + * plugin_id = "full", + * title = @Translation("Paged output, full pager"), + * short_title = @Translation("Full"), + * help = @Translation("Paged output, full Drupal style"), + * help_topic = "pager-full", + * uses_options = TRUE + * ) + */ class Full extends PagerPluginBase { function summary_title() { if (!empty($this->options['offset'])) { diff --git a/lib/Drupal/views/Plugins/views/pager/Mini.php b/lib/Drupal/views/Plugins/views/pager/Mini.php index d3d37d1bc492c9203d4329bd75706575cad7dfb7..f83552c535d25931ae394c039a1d9f55ae5a4f22 100644 --- a/lib/Drupal/views/Plugins/views/pager/Mini.php +++ b/lib/Drupal/views/Plugins/views/pager/Mini.php @@ -7,11 +7,25 @@ namespace Drupal\views\Plugins\views\pager; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * The plugin to handle full pager. * * @ingroup views_pager_plugins */ + +/** + * @Plugin( + * plugin_id = "mini", + * title = @Translation("Paged output, mini pager"), + * short_title = @Translation("Mini"), + * help = @Translation("Use the mini pager output."), + * help_topic = "pager-mini", + * uses_options = TRUE + * ) + */ class Mini extends PagerPluginBase { function summary_title() { if (!empty($this->options['offset'])) { diff --git a/lib/Drupal/views/Plugins/views/pager/None.php b/lib/Drupal/views/Plugins/views/pager/None.php index 8d10356c5db0a47350caa75495f71e071cd27a59..20733b37650921a4016d7d9e6b8b00398db1a7fa 100644 --- a/lib/Drupal/views/Plugins/views/pager/None.php +++ b/lib/Drupal/views/Plugins/views/pager/None.php @@ -7,11 +7,25 @@ namespace Drupal\views\Plugins\views\pager; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Plugin for views without pagers. * * @ingroup views_pager_plugins */ + +/** + * @Plugin( + * plugin_id = "none", + * title = @Translation("Display all items"), + * help = @Translation("Display all items that this view might find."), + * help_topic = "pager-none", + * uses_options = TRUE, + * type = "basic" + * ) + */ class None extends PagerPluginBase { function init(&$view, &$display, $options = array()) { diff --git a/lib/Drupal/views/Plugins/views/pager/Some.php b/lib/Drupal/views/Plugins/views/pager/Some.php index fcbd14645f7f24bcf130ec14d0c59601fd682c47..4bf1d1de3594ac33a87235a9dc348dfa12f48fc4 100644 --- a/lib/Drupal/views/Plugins/views/pager/Some.php +++ b/lib/Drupal/views/Plugins/views/pager/Some.php @@ -7,11 +7,25 @@ namespace Drupal\views\Plugins\views\pager; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Plugin for views without pagers. * * @ingroup views_pager_plugins */ + +/** + * @Plugin( + * plugin_id = "some", + * title = @Translation("Display a specified number of items"), + * help = @Translation("Display a limited number items that this view might find."), + * help_topic = "pager-some", + * uses_options = TRUE, + * type = "basic" + * ) + */ class Some extends PagerPluginBase { function summary_title() { if (!empty($this->options['offset'])) { diff --git a/lib/Drupal/views/Plugins/views/query/Sql.php b/lib/Drupal/views/Plugins/views/query/Sql.php index 3f3d501af635d71d9c353784b73b51232a5234ec..0bd77579b44d9d54d0de8b1e066440a12ac6eee6 100644 --- a/lib/Drupal/views/Plugins/views/query/Sql.php +++ b/lib/Drupal/views/Plugins/views/query/Sql.php @@ -10,7 +10,16 @@ use Drupal\Core\Database\Database; use Drupal\views\Join; use Exception; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; +/** + * @Plugin( + * plugin_id = "views_query", + * title = @Translation("SQL Query"), + * help = @Translation("Query will be generated and run using the Drupal database API.") + * ) + */ class Sql extends QueryPluginBase { /** * A list of tables in the order they should be added, keyed by alias. diff --git a/lib/Drupal/views/Plugins/views/row/Fields.php b/lib/Drupal/views/Plugins/views/row/Fields.php index f454d92364e7d61320050f3e260a2f82da46cb5f..5482652152e3f94410a9a32afe2f0e709c01995c 100644 --- a/lib/Drupal/views/Plugins/views/row/Fields.php +++ b/lib/Drupal/views/Plugins/views/row/Fields.php @@ -7,6 +7,9 @@ namespace Drupal\views\Plugins\views\row; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * The basic 'fields' row plugin * @@ -15,6 +18,19 @@ * * @ingroup views_row_plugins */ + +/** + * @Plugin( + * plugin_id = "fields", + * title = @Translation("Fields"), + * help = @Translation("Displays the fields with an optional template."), + * theme = "views_view_fields", + * uses_fields = TRUE, + * uses_options = TRUE, + * type = "normal", + * help_topic = "style-row-fields" + * ) + */ class Fields extends RowPluginBase { function option_definition() { $options = parent::option_definition(); diff --git a/lib/Drupal/views/Plugins/views/row/RssFields.php b/lib/Drupal/views/Plugins/views/row/RssFields.php index 8bfc73b72aa52f6531aceac1e5ff8b443df29972..190206a698447817a8924683d6323f87c5a1c9d5 100644 --- a/lib/Drupal/views/Plugins/views/row/RssFields.php +++ b/lib/Drupal/views/Plugins/views/row/RssFields.php @@ -7,9 +7,25 @@ namespace Drupal\views\Plugins\views\row; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Renders an RSS item based on fields. */ + +/** + * @Plugin( + * plugin_id = "rss_fields", + * title = @Translation("Fields"), + * help = @Translation("Display fields as RSS items."), + * theme = "views_view_row_rss", + * uses_fields = TRUE, + * uses_options = TRUE, + * type = "feed", + * help_topic = "style-row-fields" + * ) + */ class RssFields extends RowPluginBase { function option_definition() { $options = parent::option_definition(); diff --git a/lib/Drupal/views/Plugins/views/sort/Date.php b/lib/Drupal/views/Plugins/views/sort/Date.php index 29bc4e5b87547318ed73c745eedde853a128a018..6fd184cd09b9be2932b31531089969e13307d9fe 100644 --- a/lib/Drupal/views/Plugins/views/sort/Date.php +++ b/lib/Drupal/views/Plugins/views/sort/Date.php @@ -15,7 +15,7 @@ * This handler enables granularity, which is the ability to make dates * equivalent based upon nearness. * - * @Plugin( + * @Plugin( * plugin_id = "date" * ) * diff --git a/lib/Drupal/views/Plugins/views/sort/GroupByNumeric.php b/lib/Drupal/views/Plugins/views/sort/GroupByNumeric.php index 23ade3d97726854eee3c3cf79a9ff67738f46bdc..b217f7ec50df1954b85535c217831589e14266bf 100644 --- a/lib/Drupal/views/Plugins/views/sort/GroupByNumeric.php +++ b/lib/Drupal/views/Plugins/views/sort/GroupByNumeric.php @@ -12,7 +12,7 @@ /** * Handler for GROUP BY on simple numeric fields. * - * @Plugin( + * @Plugin( * plugin_id = "groupby_numeric" * ) */ diff --git a/lib/Drupal/views/Plugins/views/sort/MenuHierarchy.php b/lib/Drupal/views/Plugins/views/sort/MenuHierarchy.php index f524e22487ce859d1fcd9e29bc73ece28bc4b5b2..8b1b9b686ac1e806ab17b838b5a2ff923f68d171 100644 --- a/lib/Drupal/views/Plugins/views/sort/MenuHierarchy.php +++ b/lib/Drupal/views/Plugins/views/sort/MenuHierarchy.php @@ -20,7 +20,7 @@ * * This is only really useful for the {menu_links} table. * - * @Plugin( + * @Plugin( * plugin_id = "menu_hierarchy" * ) */ diff --git a/lib/Drupal/views/Plugins/views/sort/Random.php b/lib/Drupal/views/Plugins/views/sort/Random.php index ef1635b1013585db464627147fc774920c5f800d..f3e729085363c094532ac0ce6c83bb673e2b0040 100644 --- a/lib/Drupal/views/Plugins/views/sort/Random.php +++ b/lib/Drupal/views/Plugins/views/sort/Random.php @@ -12,7 +12,7 @@ /** * Handle a random sort. * - * @Plugin( + * @Plugin( * plugin_id = "random" * ) */ diff --git a/lib/Drupal/views/Plugins/views/style/DefaultStyle.php b/lib/Drupal/views/Plugins/views/style/DefaultStyle.php index eae07b90b477653b60df4225d1b9db874869b97a..0137660a0e02d1d56ae9b43c96efcf4869489267 100644 --- a/lib/Drupal/views/Plugins/views/style/DefaultStyle.php +++ b/lib/Drupal/views/Plugins/views/style/DefaultStyle.php @@ -7,12 +7,30 @@ namespace Drupal\views\Plugins\views\style; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Unformatted style plugin to render rows one after another with no * decorations. * * @ingroup views_style_plugins */ + +/** + * @Plugin( + * plugin_id = "default", + * title = @Translation("Unformatted list"), + * help = @Translation("Displays rows one after another."), + * theme = "views_view_unformatted", + * uses_row_plugin = TRUE, + * uses_row_class = TRUE, + * uses_grouping = TRUE, + * uses_options = TRUE, + * type = "normal", + * help_topic = "style-unformatted" + * ) + */ class DefaultStyle extends StylePluginBase { /** * Set default options diff --git a/lib/Drupal/views/Plugins/views/style/StyleSummaryPluginBase.php b/lib/Drupal/views/Plugins/views/style/DefaultSummary.php similarity index 83% rename from lib/Drupal/views/Plugins/views/style/StyleSummaryPluginBase.php rename to lib/Drupal/views/Plugins/views/style/DefaultSummary.php index c12c2695fb0b66ed537220fce6d5f9091f6c50cf..33bdc6cefa2173c6a0ce9be38aa3fb4bc357865c 100644 --- a/lib/Drupal/views/Plugins/views/style/StyleSummaryPluginBase.php +++ b/lib/Drupal/views/Plugins/views/style/DefaultSummary.php @@ -7,14 +7,28 @@ namespace Drupal\views\Plugins\views\style; -use Drupal\views\Plugins\views\Plugin; +use Drupal\views\Plugins\views\style\StylePluginBase; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; /** * The default style plugin for summaries. * * @ingroup views_style_plugins */ -class StyleSummaryPluginBase extends Plugin { + +/** + * @Plugin( + * plugin_id = "default_summary", + * title = @Translation("List"), + * help = @Translation("Displays the default summary as a list."), + * theme = "views_view_summary", + * type = "summary", + * uses_options = TRUE, + * help_topic = "style-summary" + * ) + */ +class DefaultSummary extends StylePluginBase { function option_definition() { $options = parent::option_definition(); diff --git a/lib/Drupal/views/Plugins/views/style/Grid.php b/lib/Drupal/views/Plugins/views/style/Grid.php index e7894419b19135945a76b72b7a5d216881b58299..38d4c93e70029eac40cbf73930ef4acb3adf752a 100644 --- a/lib/Drupal/views/Plugins/views/style/Grid.php +++ b/lib/Drupal/views/Plugins/views/style/Grid.php @@ -7,11 +7,29 @@ namespace Drupal\views\Plugins\views\style; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Style plugin to render each item in a grid cell. * * @ingroup views_style_plugins */ + +/** + * @Plugin( + * plugin_id = "grid", + * title = @Translation("Grid"), + * help = @Translation("Displays rows in a grid."), + * theme = "views_view_grid", + * uses_fields = FALSE, + * uses_row_plugin = TRUE, + * uses_row_class = TRUE, + * uses_options = TRUE, + * type = "normal", + * help_topic = "style-grid" + * ) + */ class Grid extends StylePluginBase { /** * Set default options diff --git a/lib/Drupal/views/Plugins/views/style/List.php b/lib/Drupal/views/Plugins/views/style/HtmlList.php similarity index 76% rename from lib/Drupal/views/Plugins/views/style/List.php rename to lib/Drupal/views/Plugins/views/style/HtmlList.php index 2d3119e6bbed85b078914ee8ae39acc7ad378a58..c5df06d02f7c273a0cec618f54caf2d3cba95748 100644 --- a/lib/Drupal/views/Plugins/views/style/List.php +++ b/lib/Drupal/views/Plugins/views/style/HtmlList.php @@ -7,12 +7,29 @@ namespace Drupal\views\Plugins\views\style; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Style plugin to render each item in an ordered or unordered list. * * @ingroup views_style_plugins */ -class List extends StylePluginBase { + +/** + * @Plugin( + * plugin_id = "html_list", + * title = @Translation("HTML List"), + * help = @Translation("Displays rows as HTML list."), + * theme = "views_view_list", + * uses_row_plugin = TRUE, + * uses_row_class = TRUE, + * uses_options = TRUE, + * type = "normal", + * help_topic = "style-list" + * ) + */ +class HtmlList extends StylePluginBase { /** * Set default options */ diff --git a/lib/Drupal/views/Plugins/views/style/JumpMenu.php b/lib/Drupal/views/Plugins/views/style/JumpMenu.php index b1a1b03d056f91fbb346062ec6d0d580f1525c5f..6f4b794fb95afbdee6aaac676732de12b4e40e7d 100644 --- a/lib/Drupal/views/Plugins/views/style/JumpMenu.php +++ b/lib/Drupal/views/Plugins/views/style/JumpMenu.php @@ -7,11 +7,28 @@ namespace Drupal\views\Plugins\views\style; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Style plugin to render each item as a row in a table. * * @ingroup views_style_plugins */ + +/** + * @Plugin( + * plugin_id = "jump_menu", + * title = @Translation("Jump menu"), + * help = @Translation("Puts all of the results into a select box and allows the user to go to a different page based upon the results."), + * theme = "views_view_jump_menu", + * uses_row_plugin = TRUE, + * uses_fields = TRUE, + * uses_options = TRUE, + * type = "normal", + * help_topic = "style-jump-menu" + * ) + */ class JumpMenu extends StylePluginBase { function option_definition() { $options = parent::option_definition(); diff --git a/lib/Drupal/views/Plugins/views/style/JumpMenuSummary.php b/lib/Drupal/views/Plugins/views/style/JumpMenuSummary.php index 71576e0e1b12ecba7c8715eee10587776d21f0d5..fe129c1dbbec5061d95451722bd839da03d1d43b 100644 --- a/lib/Drupal/views/Plugins/views/style/JumpMenuSummary.php +++ b/lib/Drupal/views/Plugins/views/style/JumpMenuSummary.php @@ -7,12 +7,27 @@ namespace Drupal\views\Plugins\views\style; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * The default style plugin for summaries. * * @ingroup views_style_plugins */ -class JumpMenuSummary extends StyleSummaryPluginBase { +/** + * @Plugin( + * plugin_id = "jump_menu_summary", + * title = @Translation("Jump menu"), + * help = @Translation("Puts all of the results into a select box and allows the user to go to a different page based upon the results."), + * theme = "views_view_summary_jump_menu", + * uses_options = TRUE, + * type = "summary", + * help_topic = "style-summary-jump-menu" + * ) + */ + +class JumpMenuSummary extends DefaultSummary { function option_definition() { $options = parent::option_definition(); diff --git a/lib/Drupal/views/Plugins/views/style/Rss.php b/lib/Drupal/views/Plugins/views/style/Rss.php index 49d2aaa78531465659d340154c4292cf495f36a5..331ce7c45f0a8b3e83e8b132876f62ac58ae84d6 100644 --- a/lib/Drupal/views/Plugins/views/style/Rss.php +++ b/lib/Drupal/views/Plugins/views/style/Rss.php @@ -7,11 +7,27 @@ namespace Drupal\views\Plugins\views\style; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Default style plugin to render an RSS feed. * * @ingroup views_style_plugins */ + +/** + * @Plugin( + * plugin_id = "rss", + * title = @Translation("RSS Feed"), + * help = @Translation("Generates an RSS feed from a view."), + * theme = "views_view_rss", + * uses_row_plugin = TRUE, + * uses_options = TRUE, + * type = "feed", + * help_topic = "style-rss" + * ) + */ class Rss extends StylePluginBase { function attach_to($display_id, $path, $title) { $display = $this->view->display[$display_id]->handler; diff --git a/lib/Drupal/views/Plugins/views/style/StylePluginBase.php b/lib/Drupal/views/Plugins/views/style/StylePluginBase.php index 1f1c8713c75d8045f279997280466f88784a989f..5779e3c989e36cbca9ccba486c5e0dfdd053a7de 100644 --- a/lib/Drupal/views/Plugins/views/style/StylePluginBase.php +++ b/lib/Drupal/views/Plugins/views/style/StylePluginBase.php @@ -7,7 +7,9 @@ namespace Drupal\views\Plugins\views\style; -use Drupal\views\Plugins\views\Plugin; +use Drupal\views\Plugins\views\Plugin as ViewsPlugin; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; /** * @defgroup views_style_plugins Views style plugins @@ -26,7 +28,7 @@ /** * Base class to define a style plugin handler. */ -class StylePluginBase extends Plugin { +class StylePluginBase extends ViewsPlugin { /** * Store all available tokens row rows. */ @@ -81,14 +83,14 @@ function destroy() { * Return TRUE if this style also uses a row plugin. */ function uses_row_plugin() { - return !empty($this->definition['uses row plugin']); + return !empty($this->definition['uses_row_plugin']); } /** * Return TRUE if this style also uses a row plugin. */ function uses_row_class() { - return !empty($this->definition['uses row class']); + return !empty($this->definition['uses_row_class']); } /** diff --git a/lib/Drupal/views/Plugins/views/style/Table.php b/lib/Drupal/views/Plugins/views/style/Table.php index a5111c7e2de012c7645bc971786f369c464c6327..2ed7192dedd3f28ec5b9e3ae6bea616591860689 100644 --- a/lib/Drupal/views/Plugins/views/style/Table.php +++ b/lib/Drupal/views/Plugins/views/style/Table.php @@ -7,11 +7,29 @@ namespace Drupal\views\Plugins\views\style; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * Style plugin to render each item as a row in a table. * * @ingroup views_style_plugins */ + +/** + * @Plugin( + * plugin_id = "table", + * title = @Translation("Table"), + * help = @Translation("Displays rows in a table."), + * theme = "views_view_table", + * uses_row_plugin = FALSE, + * uses_row_class = TRUE, + * uses_fields = TRUE, + * uses_options = TRUE, + * type = "normal", + * help_topic = "style-table" + * ) + */ class Table extends StylePluginBase { /** diff --git a/lib/Drupal/views/Plugins/views/style/UnformattedSummary.php b/lib/Drupal/views/Plugins/views/style/UnformattedSummary.php index 364b5615ceec197bab75faaf4387a0f36d115b1d..9eb50e96bbe7ca94cb3aaf28446c12037f77d596 100644 --- a/lib/Drupal/views/Plugins/views/style/UnformattedSummary.php +++ b/lib/Drupal/views/Plugins/views/style/UnformattedSummary.php @@ -7,12 +7,27 @@ namespace Drupal\views\Plugins\views\style; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + /** * The default style plugin for summaries. * * @ingroup views_style_plugins */ -class UnformattedSummary extends StyleSummaryPluginBase { + +/** + * @Plugin( + * plugin_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", + * type = "summary", + * uses_options = TRUE, + * help_topic = "style-summary-unformatted" + * ) + */ +class UnformattedSummary extends DefaultSummary { function option_definition() { $options = parent::option_definition(); $options['inline'] = array('default' => FALSE, 'bool' => TRUE); diff --git a/lib/Drupal/views/Plugins/views/wizard/Comment.php b/lib/Drupal/views/Plugins/views/wizard/Comment.php index c946b01af6f2acb9c6cce920e1656ef4f70426a4..8b5abb0433f75d08a326f0edca52cc34e8fe13a4 100644 --- a/lib/Drupal/views/Plugins/views/wizard/Comment.php +++ b/lib/Drupal/views/Plugins/views/wizard/Comment.php @@ -8,9 +8,46 @@ namespace Drupal\views\Plugins\views\wizard; use Drupal\views\Plugins\wizard; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + +/** + * @todo: replace numbers with constants. + */ /** * Tests creating comment views with the wizard. + * + * @Plugin( + * plugin_id = "comment", + * base_table = "comment", + * created_column = "created", + * title = @Translation("Comments"), + * filters = { + * "status" = { + * "value" = 1, + * "table" = "comment", + * "field" = "status" + * }, + * "status_node" = { + * "value" = 1, + * "table" = "node", + * "field" = "status", + * "relationship" = "nid", + * } + * }, + * path_field = { + * "id" = "cid", + * "table" = "comment", + * "field" = "cid", + * "exclude" = TRUE, + * "link_to_comment" = FALSE, + * "alter" = { + * "alter_text" = 1, + * "text" = "comment/[cid]#comment-[cid]" + * } + * } + * ) */ class Comment extends WizardBase { diff --git a/lib/Drupal/views/Plugins/views/wizard/File.php b/lib/Drupal/views/Plugins/views/wizard/File.php index e30301cfe4c19d6be9578367da6a2a917dbe2cea..c6d420192784f702a4df441e9a189b441099b093 100644 --- a/lib/Drupal/views/Plugins/views/wizard/File.php +++ b/lib/Drupal/views/Plugins/views/wizard/File.php @@ -8,9 +8,25 @@ namespace Drupal\views\Plugins\views\wizard; use Drupal\views\Plugins\views\wizard\WizardBase; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; /** * Tests creating managed files views with the wizard. + * + * @Plugin( + * plugin_id = "file_managed", + * base_table = "file_managed", + * created_column = "timestamp", + * title = @Translation("Files"), + * path_field = { + * "id" = "uri", + * "table" = "file_managed", + * "field" = "uri", + * "exclude" = TRUE, + * "file_download_path" = TRUE + * } + * ) */ class File extends WizardBase { protected function default_display_options($form, $form_state) { diff --git a/lib/Drupal/views/Plugins/views/wizard/Node.php b/lib/Drupal/views/Plugins/views/wizard/Node.php index 0592d3f057f04fe62ecb0723f143ed2028be3ce6..532adf4a69e558123eebe6e9fb222b7875dc16ff 100644 --- a/lib/Drupal/views/Plugins/views/wizard/Node.php +++ b/lib/Drupal/views/Plugins/views/wizard/Node.php @@ -8,10 +8,46 @@ namespace Drupal\views\Plugins\views\wizard; use Drupal\views\Plugins\views\wizard\WizardBase; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + +/** + * @todo: replace numbers with constants. + */ /** * Tests creating node views with the wizard. + * + * @Plugin( + * plugin_id = "node", + * base_table = "node", + * created_column = "created", + * title = @Translation("Content"), + * available_sorts = { + * "title:DESC" = @Translation("Title") + * }, + * filters = { + * "status" = { + * "value" = 1, + * "table" = "node", + * "field" = "status" + * } + * }, + * path_field = { + * "id" = "nid", + * "table" = "node", + * "field" = "nid", + * "exclude" = TRUE, + * "link_to_node" = FALSE, + * "alter" = { + * "alter_text" = 1, + * "text" = "node/[nid]" + * } + * } + * ) + * */ + class Node extends WizardBase { protected function row_style_options($type) { diff --git a/lib/Drupal/views/Plugins/views/wizard/NodeRevision.php b/lib/Drupal/views/Plugins/views/wizard/NodeRevision.php index 0e2fa1160515032bfc33d611bd714a3113e1a9a5..2fcec62dff24fe274bf137e8d20b1f189a0bd420 100644 --- a/lib/Drupal/views/Plugins/views/wizard/NodeRevision.php +++ b/lib/Drupal/views/Plugins/views/wizard/NodeRevision.php @@ -8,9 +8,46 @@ namespace Drupal\views\Plugins\views\wizard; use Drupal\views\Plugins\views\wizard\WizardBase; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + +/** + * @todo: replace numbers with constants. + */ /** * Tests creating node revision views with the wizard. + * + * @Plugin( + * plugin_id = "node_revision", + * base_table = "node_revision", + * created_column = "timestamp", + * title = @Translation("Content revisions"), + * filters = { + * "status" = { + * "value" = 1, + * "table" = "node", + * "field" = "status" + * } + * }, + * path_field = { + * "id" = "vid", + * "table" = "node_revision", + * "field" = "vid", + * "exclude" = TRUE, + * "alter" = { + * "alter_text" = 1, + * "text" = "node/[nid]/revisions/[vid]/view" + * } + * }, + * path_fields_supplemental = { + * "id" = "id", + * "table" = "node", + * "field" = "nid", + * "exclude" = TRUE, + * "link_to_node" = FALSE + * } + * ) */ class NodeRevision extends WizardBase { diff --git a/lib/Drupal/views/Plugins/views/wizard/TaxonomyTerm.php b/lib/Drupal/views/Plugins/views/wizard/TaxonomyTerm.php index 3137dd189366d67cfcf8a5584f5ab878851c3fa6..629df9ed625fa75aec7553f61a12cf4de2620235 100644 --- a/lib/Drupal/views/Plugins/views/wizard/TaxonomyTerm.php +++ b/lib/Drupal/views/Plugins/views/wizard/TaxonomyTerm.php @@ -8,9 +8,29 @@ namespace Drupal\views\Plugins\views\wizard; use Drupal\views\Plugins\views\wizard\WizardBase; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; /** * Tests creating taxonomy views with the wizard. + * + * @Plugin( + * plugin_id = "taxonomy_term", + * base_table = "taxonomy_term_data", + * created_column = "created", + * title = @Translation("Taxonomy terms"), + * filters = {""}, + * path_field = { + * "id" = "tid", + * "table" = "taxonomy_term_data", + * "field" = "tid", + * "exclude" = TRUE, + * "alter" = { + * "alter_text" = 1, + * "text" = "taxonomy/term/[tid]" + * } + * } + * ) */ class TaxonomyTerm extends WizardBase { diff --git a/lib/Drupal/views/Plugins/views/wizard/Users.php b/lib/Drupal/views/Plugins/views/wizard/Users.php index ea7524cdce17929b3eb8e31d25be902d2d28bfeb..e55b486028368e103ecd8cff78e6ed8cec7d3181 100644 --- a/lib/Drupal/views/Plugins/views/wizard/Users.php +++ b/lib/Drupal/views/Plugins/views/wizard/Users.php @@ -8,9 +8,40 @@ namespace Drupal\views\Plugins\views\wizard; use Drupal\views\Plugins\views\wizard\WizardBase; +use Drupal\Core\Annotation\Plugin; +use Drupal\Core\Annotation\Translation; + +/** + * @todo: replace numbers with constants. + */ /** * Tests creating user views with the wizard. + * + * @Plugin( + * plugin_id = "users", + * base_table = "users", + * created_column = "created", + * title = @Translation("Users"), + * filters = { + * "status" = { + * "value" = 1, + * "table" = "users", + * "field" = "status" + * } + * }, + * path_field = { + * "id" = "uid", + * "table" = "users", + * "field" = "uid", + * "exclude" = TRUE, + * "link_to_user" = FALSE, + * "alter" = { + * "alter_text" = 1, + * "text" = "user/[uid]" + * } + * } + * ) */ class Users extends WizardBase { protected function default_display_options($form, $form_state) { diff --git a/lib/Drupal/views/Tests/TranslatableTest.php b/lib/Drupal/views/Tests/TranslatableTest.php index 93efcb5fb9119621532796f8c6930518cd64078a..9039b871e304115d28ec6e4b956f00de9ded63b3 100644 --- a/lib/Drupal/views/Tests/TranslatableTest.php +++ b/lib/Drupal/views/Tests/TranslatableTest.php @@ -30,7 +30,7 @@ public function viewsPlugins() { return array( 'localization' => array( 'test' => array( - 'no ui' => TRUE, + 'no_ui' => TRUE, 'title' => t('Test'), 'help' => t('This is a test description.'), 'handler' => 'views_plugin_localization_test', diff --git a/modules/comment.views.inc b/modules/comment.views.inc index 930720da2df9936fe34acb5c3c3194a94ad49f15..50960171f4b9f2bfc3d72b071f0fc0f2a68ca7e8 100644 --- a/modules/comment.views.inc +++ b/modules/comment.views.inc @@ -660,42 +660,3 @@ function template_preprocess_views_view_row_comment(&$vars) { } $vars['comment'] = drupal_render($build); } - -/** - * Implements hook_views_wizard(). - */ -function comment_views_wizard() { - $plugins['comment'] = array( - 'name' => 'comment', - 'base_table' => 'comment', - 'created_column' => 'created', - 'class' => 'Drupal\views\Plugins\views\wizard\Comment', - 'title' => t('Comments'), - 'filters' => array( - 'status' => array( - 'value' => COMMENT_PUBLISHED, - 'table' => 'comment', - 'field' => 'status', - ), - 'status_node' => array( - 'value' => NODE_PUBLISHED, - 'table' => 'node', - 'field' => 'status', - 'relationship' => 'nid', - ), - ), - 'path_field' => array( - 'id' => 'cid', - 'table' => 'comment', - 'field' => 'cid', - 'exclude' => TRUE, - 'link_to_comment' => FALSE, - 'alter' => array( - 'alter_text' => 1, - 'text' => 'comment/[cid]#comment-[cid]', - ), - ), - ); - - return $plugins; -} diff --git a/modules/comment.views_default.inc b/modules/comment.views_default.inc index 414f721bad191f4c34e3bbd555fccfe75dc9cbe3..1609caeb9d3bad7baee0e5a219a7117772ecf6c5 100644 --- a/modules/comment.views_default.inc +++ b/modules/comment.views_default.inc @@ -32,7 +32,7 @@ function comment_views_default_views() { $handler->display->display_options['exposed_form']['type'] = 'basic'; $handler->display->display_options['pager']['type'] = 'some'; $handler->display->display_options['pager']['options']['items_per_page'] = 5; - $handler->display->display_options['style_plugin'] = 'list'; + $handler->display->display_options['style_plugin'] = 'html_list'; $handler->display->display_options['row_plugin'] = 'fields'; /* Relationship: Comment: Content */ $handler->display->display_options['relationships']['nid']['id'] = 'nid'; @@ -65,7 +65,7 @@ function comment_views_default_views() { /* Display: Page */ $handler = $view->new_display('page', 'Page', 'page'); $handler->display->display_options['defaults']['style_plugin'] = FALSE; - $handler->display->display_options['style_plugin'] = 'list'; + $handler->display->display_options['style_plugin'] = 'html_list'; $handler->display->display_options['defaults']['style_options'] = FALSE; $handler->display->display_options['defaults']['row_plugin'] = FALSE; $handler->display->display_options['row_plugin'] = 'fields'; diff --git a/modules/node.views.inc b/modules/node.views.inc index 76ec68771934c5fd80552aeba4a7f566521fa4dc..5e5c3fa18c29ab66f758c5a02f5d00a44dc2126c 100644 --- a/modules/node.views.inc +++ b/modules/node.views.inc @@ -756,72 +756,9 @@ function node_views_analyze($view) { * Implements hook_views_wizard(). */ function node_views_wizard() { - $plugins['node'] = array( - 'name' => 'node', - 'base_table' => 'node', - 'created_column' => 'created', - 'available_sorts' => array( - 'title:DESC' => t('Title') - ), - 'class' => 'Drupal\views\Plugins\views\wizard\Node', - 'title' => t('Content'), - 'filters' => array( - 'status' => array( - 'value' => NODE_PUBLISHED, - 'table' => 'node', - 'field' => 'status', - ), - ), - 'path_field' => array( - 'id' => 'nid', - 'table' => 'node', - 'field' => 'nid', - 'exclude' => TRUE, - 'link_to_node' => FALSE, - 'alter' => array( - 'alter_text' => 1, - 'text' => 'node/[nid]', - ), - ), - ); - + // @todo: figure this piece out. if (module_exists('statistics')) { $plugins['node']['available_sorts']['node_counter-totalcount:DESC'] = t('Number of hits'); } - $plugins['node_revision'] = array( - 'name' => 'node_revision', - 'base_table' => 'node_revision', - 'created_column' => 'timestamp', - 'class' => 'Drupal\views\Plugins\views\wizard\NodeRevision', - 'title' => t('Content revisions'), - 'filters' => array( - 'status' => array( - 'value' => '1', - 'table' => 'node', // @todo - unclear if this should be node or node_revision - 'field' => 'status', - ), - ), - 'path_field' => array( - 'id' => 'vid', - 'table' => 'node_revision', - 'field' => 'vid', - 'exclude' => TRUE, - 'alter' => array( - 'alter_text' => 1, - 'text' => 'node/[nid]/revisions/[vid]/view', - ), - ), - 'path_fields_supplemental' => array( - array( - 'id' => 'nid', - 'table' => 'node', - 'field' => 'nid', - 'exclude' => TRUE, - 'link_to_node' => FALSE, - ), - ), - ); - - return $plugins; } diff --git a/modules/search.views_default.inc b/modules/search.views_default.inc index 1645f30ea33ac9abc30c50f167bc0e0968d9e6c5..7567703227f798b30556ff1e972041c304ee4ccd 100644 --- a/modules/search.views_default.inc +++ b/modules/search.views_default.inc @@ -30,7 +30,7 @@ function search_views_default_views() { $handler->display->display_options['exposed_form']['type'] = 'basic'; $handler->display->display_options['pager']['type'] = 'full'; $handler->display->display_options['pager']['options']['items_per_page'] = 30; - $handler->display->display_options['style_plugin'] = 'list'; + $handler->display->display_options['style_plugin'] = 'html_list'; $handler->display->display_options['style_options']['type'] = 'ol'; $handler->display->display_options['row_plugin'] = 'fields'; /* No results behavior: Global: Text area */ @@ -77,7 +77,7 @@ function search_views_default_views() { $handler->display->display_options['defaults']['use_more'] = FALSE; $handler->display->display_options['use_more'] = TRUE; $handler->display->display_options['defaults']['style_plugin'] = FALSE; - $handler->display->display_options['style_plugin'] = 'list'; + $handler->display->display_options['style_plugin'] = 'html_list'; $handler->display->display_options['defaults']['style_options'] = FALSE; $handler->display->display_options['defaults']['row_plugin'] = FALSE; $handler->display->display_options['row_plugin'] = 'fields'; diff --git a/modules/statistics.views_default.inc b/modules/statistics.views_default.inc index 1afb499a217259d02652ce009e952474695fa61e..55e82afbb9468f6efdbc3e966ea8323f37420d68 100644 --- a/modules/statistics.views_default.inc +++ b/modules/statistics.views_default.inc @@ -159,7 +159,7 @@ function statistics_views_default_views() { /* Display: Popular (block) */ $handler = $view->new_display('block', 'Popular (block)', 'block'); $handler->display->display_options['defaults']['style_plugin'] = FALSE; - $handler->display->display_options['style_plugin'] = 'list'; + $handler->display->display_options['style_plugin'] = 'html_list'; $handler->display->display_options['defaults']['style_options'] = FALSE; $handler->display->display_options['defaults']['row_plugin'] = FALSE; $handler->display->display_options['row_plugin'] = 'fields'; @@ -190,7 +190,7 @@ function statistics_views_default_views() { $handler->display->display_options['defaults']['link_display'] = FALSE; $handler->display->display_options['link_display'] = 'page_1'; $handler->display->display_options['defaults']['style_plugin'] = FALSE; - $handler->display->display_options['style_plugin'] = 'list'; + $handler->display->display_options['style_plugin'] = 'html_list'; $handler->display->display_options['defaults']['style_options'] = FALSE; $handler->display->display_options['defaults']['row_plugin'] = FALSE; $handler->display->display_options['row_plugin'] = 'fields'; diff --git a/views.api.php b/views.api.php index 1e4e38ce77f4b9d420bc8a673332d294bfb92fe9..d774f5d652c3bd917c0de37d593c7ecfebf73c37 100644 --- a/views.api.php +++ b/views.api.php @@ -260,10 +260,10 @@ * 'title' => t('Feed'), * 'help' => t('Display the view as a feed, such as an RSS feed.'), * 'handler' => 'views_plugin_display_feed', - * 'uses hook menu' => TRUE, + * 'uses_hook_menu' => TRUE, * 'use ajax' => FALSE, * 'use pager' => FALSE, - * 'accept attachments' => FALSE, + * 'accept_attachments' => FALSE, * 'admin' => t('Feed'), * 'help topic' => 'display-feed', * ), @@ -535,7 +535,7 @@ function hook_views_data_alter(&$data) { * - parent: The name of the plugin this plugin extends. Since Drupal 7 this * is no longer required, but may still be useful from a code readability * perspective. - * - no ui: Set to TRUE to denote that the plugin doesn't appear to be + * - no_ui: Set to TRUE to denote that the plugin doesn't appear to be * selectable in the ui, though on the api side they still exists. * - uses options: Set to TRUE to denote that the plugin has an additional * options form. @@ -560,18 +560,15 @@ function hook_views_data_alter(&$data) { * disabled there will be no ajax option in the ui. * - use pager: Set to TRUE to allow paging in the display. * - use more: Set to TRUE to allow the 'use more' setting in the display. - * - accept attachments: Set to TRUE to allow attachment displays to be + * - accept_attachments: Set to TRUE to allow attachment displays to be * attached to this display type. - * - contextual links locations: An array with places where contextual links + * - contextual_links_locations: An array with places where contextual links * should be added. Can for example be 'page' or 'block'. If you don't - * specify it there will be contextual links around the rendered view. If - * this is not set or regions have been specified, views will display an - * option to 'hide contextual links'. Use an empty array if you do not want - * this. - * - uses hook menu: Set to TRUE to have the display included by + * specify it there will be contextual links around the rendered view. + * - uses_hook_menu: Set to TRUE to have the display included by * views_menu_alter(). views_menu_alter executes then execute_hook_menu * on the display object. - * - uses hook block: Set to TRUE to have the display included by + * - uses_hook_block: Set to TRUE to have the display included by * views_block_info(). * - theme: The name of a theme suggestion to use for the display. * - js: An array with paths to js files that should be included for the @@ -579,8 +576,8 @@ function hook_views_data_alter(&$data) { * root. * * - Used by style plugins: - * - uses row plugin: Set to TRUE to allow row plugins for this style. - * - uses row class: Set to TRUE to allow the CSS class settings for rows. + * - uses_row_plugin: Set to TRUE to allow row plugins for this style. + * - uses_row_class: Set to TRUE to allow the CSS class settings for rows. * - uses fields: Set to TRUE to have the style plugin accept field * handlers. * - uses grouping: Set to TRUE to allow the grouping settings for rows. diff --git a/views.module b/views.module index 19e54fd3a4b809bf3d56c53faa70f258531940da..cb26fa8844ec04c9435207545870d35d6da2d0ca 100644 --- a/views.module +++ b/views.module @@ -26,6 +26,7 @@ use Drupal\views\Plugins\Type\RowPluginManager; use Drupal\views\Plugins\Type\ExposedFormPluginManager; use Drupal\views\Plugins\Type\HandlerPluginManager; +use Drupal\views\Plugins\Type\DisplayExtenderPluginManager; /** * Advertise the current views api version @@ -459,7 +460,7 @@ function views_menu() { */ function views_menu_alter(&$callbacks) { $our_paths = array(); - $views = views_get_applicable_views('uses hook menu'); + $views = views_get_applicable_views('uses_hook_menu'); foreach ($views as $data) { list($view, $display_id) = $data; $result = $view->execute_hook_menu($display_id, $callbacks); @@ -673,7 +674,7 @@ function views_block_info() { $view->init_display(); foreach ($view->display as $display_id => $display) { - if (isset($display->handler) && !empty($display->handler->definition['uses hook block'])) { + if (isset($display->handler) && !empty($display->handler->definition['uses_hook_block'])) { $result = $display->handler->execute_hook_block_list(); if (is_array($result)) { $items = array_merge($items, $result); @@ -818,7 +819,7 @@ function views_add_block_contextual_links(&$block, $view, $display_id, $block_ty * defined any contextual links that are intended to be displayed in the * requested location; if so, it attaches them. The contextual links intended * for a particular location are defined by the 'contextual links' and - * 'contextual links locations' properties in hook_views_plugins() and + * 'contextual_links_locations' properties in hook_views_plugins() and * hook_views_plugins_alter(); as a result, these hook implementations have * full control over where and how contextual links are rendered for each * display. @@ -858,7 +859,7 @@ function views_add_block_contextual_links(&$block, $view, $display_id, $block_ty * If you are rendering a view and its contextual links in another location, * you can pass in a different value for this parameter. However, you will * also need to use hook_views_plugins() or hook_views_plugins_alter() to - * declare, via the 'contextual links locations' array key, which view + * declare, via the 'contextual_links_locations' array key, which view * displays support having their contextual links rendered in the location * you have defined. * @param $view @@ -879,14 +880,19 @@ function views_add_contextual_links(&$render_element, $location, $view, $display // contextual links that are intended to be displayed in the requested // location. $plugin = views_fetch_plugin_data('display', $view->display[$display_id]->display_plugin); - // If contextual links locations are not set, provide a sane default. (To + // If contextual_links_locations are not set, provide a sane default. (To // avoid displaying any contextual links at all, a display plugin can still - // set 'contextual links locations' to, e.g., an empty array.) - $plugin += array('contextual links locations' => array('view')); + // set 'contextual_links_locations' to, e.g., {""}.) + if (!(isset($plugin['contextual_links_locations']) && $plugin['contextual_links_locations'] = array(""))) { + $plugin += array('contextual_links_locations' => array('view')); + } + else { + $plugin['contextual_links_locations'] = array(); + } // On exposed_forms blocks contextual links should always be visible. - $plugin['contextual links locations'][] = 'special_block_-exp'; - $has_links = !empty($plugin['contextual links']) && !empty($plugin['contextual links locations']); - if ($has_links && in_array($location, $plugin['contextual links locations'])) { + $plugin['contextual_links_locations'][] = 'special_block_-exp'; + $has_links = !empty($plugin['contextual links']) && !empty($plugin['contextual_links_locations']); + if ($has_links && in_array($location, $plugin['contextual_links_locations'])) { foreach ($plugin['contextual links'] as $module => $link) { $args = array(); $valid = TRUE; @@ -1311,9 +1317,9 @@ function views_fetch_data($table = NULL, $move = TRUE, $reset = FALSE) { /** * Fetch the plugin data from cache. */ -function views_fetch_plugin_data($type = NULL, $plugin = NULL, $reset = FALSE) { +function views_fetch_plugin_data($type = NULL, $plugin_id = NULL, $reset = FALSE) { views_include('cache'); - return _views_fetch_plugin_data($type, $plugin, $reset); + return _views_fetch_plugin_data($type, $plugin_id, $reset); } /** @@ -1331,23 +1337,22 @@ function views_fetch_plugin_data($type = NULL, $plugin = NULL, $reset = FALSE) { * A keyed array of in the form of 'base_table' => 'Description'. */ function views_fetch_plugin_names($type, $key = NULL, $base = array()) { - $data = views_fetch_plugin_data(); - - $plugins[$type] = array(); + $manager = views_get_plugin_manager($type); + $definitions = $manager->getDefinitions(); + $plugins = array(); - foreach ($data[$type] as $id => $plugin) { - // Skip plugins that don't conform to our key. - if ($key && (empty($plugin['type']) || $plugin['type'] != $key)) { - continue; - } + foreach ($definitions as $plugin_id => $plugin) { if (empty($plugin['no ui']) && (empty($base) || empty($plugin['base']) || array_intersect($base, $plugin['base']))) { - $plugins[$type][$id] = $plugin['title']; + $plugins[$plugin_id] = $plugin['title']; + if (!isset($plugin['title'])) { + dsm($plugin); + } } } - if (!empty($plugins[$type])) { - asort($plugins[$type]); - return $plugins[$type]; + if (!empty($plugins)) { + asort($plugins); + return $plugins; } // fall-through return array(); @@ -1356,16 +1361,22 @@ function views_fetch_plugin_names($type, $key = NULL, $base = array()) { /** * Get a handler for a plugin * + * @param string $type + * The plugin type like access or display. + * @param string $plugin_id + * The name of the plugin like standard. + * * @return views_plugin * * The created plugin object. */ -function views_get_plugin($type, $plugin, $reset = FALSE) { +function views_get_plugin($type, $plugin_id, $reset = FALSE) { views_include('handlers'); - $definition = views_fetch_plugin_data($type, $plugin, $reset); + $manager = views_get_plugin_manager($type); + $definition = $manager->getDefinition($plugin_id); if (!empty($definition)) { - return _views_create_plugin($type, $plugin, $definition); + return _views_create_plugin($type, $plugin_id, $definition); } } @@ -1413,6 +1424,9 @@ function views_get_plugin_manager($type) { case 'localization': $manager = new LocalizationPluginManager(); break; + case 'display_extender': + $manager = new DisplayExtenderPluginManager(); + break; case 'field': case 'filter': case 'argument': @@ -1446,6 +1460,20 @@ function views_get_localization_plugin() { return $plugin; } +/** + * Get enabled display extenders. + */ +function views_get_enabled_display_extenders() { + $enabled = array_filter((array) config('views.settings')->get('views_display_extenders')); + $options = views_fetch_plugin_names('display_extender'); + foreach ($options as $name => $plugin) { + $enabled[$name] = $name; + } + + return array_filter($enabled); +} + + // ----------------------------------------------------------------------- // Views database functions @@ -1522,7 +1550,7 @@ function views_get_applicable_views($type) { foreach (array_keys($view->display) as $id) { $plugin = views_fetch_plugin_data('display', $view->display[$id]->display_plugin); if (!empty($plugin[$type])) { - // This view uses hook menu. Clone it so that different handlers + // This view uses_hook_menu. Clone it so that different handlers // don't trip over each other, and add it to the list. $v = $view->clone_view(); if ($v->set_display($id) && $v->display_handler->get_option('enabled')) {