fix several different kind of unrelated things
parent
49b44b5f00
commit
b158b24ab0
|
@ -705,9 +705,9 @@ function views_ui_nojs_submit($form, &$form_state) {
|
|||
*/
|
||||
function views_ui_wizard_form_validate($form, &$form_state) {
|
||||
$wizard = views_ui_get_wizard($form_state['values']['show']['wizard_key']);
|
||||
$manager = new WizardManager();
|
||||
$manager = views_get_plugin_manager('wizard');
|
||||
$form_state['wizard'] = $wizard;
|
||||
$form_state['wizard_instance'] = $manager->createInstance($wizard['name']);
|
||||
$form_state['wizard_instance'] = $manager->createInstance($wizard['plugin_id']);
|
||||
$errors = $form_state['wizard_instance']->validate($form, $form_state);
|
||||
foreach ($errors as $name => $message) {
|
||||
form_set_error($name, $message);
|
||||
|
|
|
@ -88,6 +88,17 @@ function _views_data_process_entity_types(&$data) {
|
|||
*/
|
||||
function _views_fetch_plugin_data($type = NULL, $plugin_id = NULL, $reset = FALSE) {
|
||||
$manager = views_get_plugin_manager($type);
|
||||
|
||||
if (!$type && !$plugin_id) {
|
||||
$plugins = array();
|
||||
$plugin_types = array('access', 'argument_default', 'argument_validator', 'cache', 'display_extender', 'display', 'exposed_form', 'localization', 'pager', 'query', 'row', 'style', 'wizard');
|
||||
foreach ($plugin_types as $plugin_type) {
|
||||
$manager = views_get_plugin_manager($plugin_type);
|
||||
$plugins[$plugin_type] = $manager->getDefinitions();
|
||||
}
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
if (!$plugin_id) {
|
||||
return $manager->getDefinitions();
|
||||
}
|
||||
|
|
|
@ -6,42 +6,46 @@
|
|||
*/
|
||||
|
||||
namespace Drupal\views\Plugins\Discovery;
|
||||
use Drupal\Core\Plugin\Discovery\HookDiscovery;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
|
||||
/**
|
||||
* Discovery interface which supports the hook_views_plugins mechanism.
|
||||
*/
|
||||
class ViewsDiscovery extends HookDiscovery {
|
||||
/**
|
||||
* The plugin type in views which should be discovered, for example query.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $viewsPluginType;
|
||||
|
||||
/**
|
||||
* Constructs a Drupal\views\Plugin\Discovery\ViewsDiscovery object.
|
||||
*
|
||||
* @param string $hook
|
||||
* The Drupal hook that a module can implement in order to interface to
|
||||
* this discovery class.
|
||||
* @param string $plugin_type
|
||||
* The plugin type in views which should be discovered, for example query.
|
||||
*/
|
||||
function __construct($hook, $plugin_type) {
|
||||
$this->viewsPluginType = $plugin_type;
|
||||
parent::__construct($hook);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Plugin\Discovery\DicoveryInterface::getDefinitions().
|
||||
*/
|
||||
class ViewsDiscovery extends AnnotatedClassDiscovery {
|
||||
public function getDefinitions() {
|
||||
views_include('plugins');
|
||||
views_include_handlers();
|
||||
$definitions = parent::getDefinitions();
|
||||
foreach ($definitions as $definition) {
|
||||
// @todo: Allow other modules to write views plugins
|
||||
$module_dir = $module = 'views';
|
||||
// Setup automatic path/file finding for theme registration
|
||||
if ($module_dir == 'views') {
|
||||
$theme_path = drupal_get_path('module', $module_dir) . '/theme';
|
||||
$theme_file = 'theme.inc';
|
||||
$path = drupal_get_path('module', $module_dir) . '/plugins';
|
||||
}
|
||||
else {
|
||||
$theme_path = $path = drupal_get_path('module', $module_dir);
|
||||
$theme_file = "$module.views.inc";
|
||||
}
|
||||
|
||||
$definitions = module_invoke_all($this->hook);
|
||||
drupal_alter($this->hook, $definitions);
|
||||
return $definitions[$this->viewsPluginType];
|
||||
$definition['module'] = $module_dir;
|
||||
if (!isset($definition['theme path'])) {
|
||||
$definition['theme path'] = $theme_path;
|
||||
}
|
||||
if (!isset($definition['theme file'])) {
|
||||
$definition['theme file'] = $theme_file;
|
||||
}
|
||||
if (!isset($definition['path'])) {
|
||||
$definition['path'] = $path;
|
||||
}
|
||||
if (!isset($definition['parent'])) {
|
||||
$definition['parent'] = 'parent';
|
||||
}
|
||||
|
||||
// merge the new data in
|
||||
$definitions[$definition['plugin_id']] = $definition;
|
||||
}
|
||||
|
||||
return $definitions;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,10 @@ namespace Drupal\views\Plugins\Type;
|
|||
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 AnnotatedClassDiscovery('views', 'access');
|
||||
$this->factory = new DefaultFactory($this);
|
||||
$this->discovery = new ViewsDiscovery('views', 'access');
|
||||
$this->factory = new DefaultFactory($this->discovery);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,12 @@ namespace Drupal\views\Plugins\Type;
|
|||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\views\Plugins\Discovery\ViewsDiscovery;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
|
||||
|
||||
class ArgumentDefaultPluginManager extends PluginManagerBase {
|
||||
public function __construct() {
|
||||
$this->discovery = new ViewsDiscovery('views_plugins', 'argument default');
|
||||
$this->factory = new DefaultFactory($this);
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'argument_default');
|
||||
$this->factory = new DefaultFactory($this->discovery);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,6 @@ use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
|||
class ArgumentValidatorPluginManager extends PluginManagerBase {
|
||||
public function __construct() {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'argument_validator');
|
||||
$this->factory = new DefaultFactory($this);
|
||||
$this->factory = new DefaultFactory($this->discovery);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,6 @@ use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
|||
class CachePluginManager extends PluginManagerBase {
|
||||
public function __construct() {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'cache');
|
||||
$this->factory = new DefaultFactory($this);
|
||||
$this->factory = new DefaultFactory($this->discovery);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,11 @@ namespace Drupal\views\Plugins\Type;
|
|||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
|
||||
|
||||
class DisplayExtenderPluginManager extends PluginManagerBase {
|
||||
public function __construct() {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'display_extender');
|
||||
$this->factory = new DefaultFactory($this);
|
||||
$this->discovery = new ViewsDiscovery('views', 'display_extender');
|
||||
$this->factory = new DefaultFactory($this->discovery);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,11 @@ namespace Drupal\views\Plugins\Type;
|
|||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
|
||||
use Drupal\views\Plugins\Discovery\ViewsDiscovery;
|
||||
|
||||
class DisplayPluginManager extends PluginManagerBase {
|
||||
public function __construct() {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'display');
|
||||
$this->factory = new DefaultFactory($this);
|
||||
$this->discovery = new ViewsDiscovery('views', 'display');
|
||||
$this->factory = new DefaultFactory($this->discovery);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,11 @@ namespace Drupal\views\Plugins\Type;
|
|||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
|
||||
use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
|
||||
|
||||
class ExposedFormPluginManager extends PluginManagerBase {
|
||||
public function __construct() {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'exposed_form');
|
||||
$this->discovery = new ViewsDiscovery('views', 'exposed_form');
|
||||
$this->factory = new DefaultFactory($this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace Drupal\views\Plugins\Type;
|
|||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
|
||||
|
||||
class HandlerPluginManager extends PluginManagerBase {
|
||||
/**
|
||||
|
@ -22,9 +22,7 @@ class HandlerPluginManager extends PluginManagerBase {
|
|||
public function __construct($type) {
|
||||
$this->type = $type;
|
||||
|
||||
if (in_array($this->type, array('sort', 'filter', 'relationship', 'field', 'area', 'argument'))) {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', $this->type);
|
||||
}
|
||||
$this->discovery = new ViewsDiscovery('views', $this->type);
|
||||
$this->factory = new DefaultFactory($this->discovery);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,11 @@ namespace Drupal\views\Plugins\Type;
|
|||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
|
||||
use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
|
||||
|
||||
class LocalizationPluginManager extends PluginManagerBase {
|
||||
public function __construct() {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'localization');
|
||||
$this->discovery = new ViewsDiscovery('views', 'localization');
|
||||
$this->factory = new DefaultFactory($this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,11 @@ namespace Drupal\views\Plugins\Type;
|
|||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
|
||||
use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
|
||||
|
||||
class PagerPluginManager extends PluginManagerBase {
|
||||
public function __construct() {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'pager');
|
||||
$this->discovery = new ViewsDiscovery('views', 'pager');
|
||||
$this->factory = new DefaultFactory($this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,11 @@ namespace Drupal\views\Plugins\Type;
|
|||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
|
||||
|
||||
class QueryPluginManager extends PluginManagerBase {
|
||||
public function __construct() {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'query');
|
||||
$this->discovery = new ViewsDiscovery('views', 'query');
|
||||
$this->factory = new DefaultFactory($this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,11 @@ namespace Drupal\views\Plugins\Type;
|
|||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
|
||||
|
||||
class RowPluginManager extends PluginManagerBase {
|
||||
public function __construct() {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'row');
|
||||
$this->discovery = new ViewsDiscovery('views', 'row');
|
||||
$this->factory = new DefaultFactory($this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,12 @@ namespace Drupal\views\Plugins\Type;
|
|||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
|
||||
|
||||
|
||||
class StylePluginManager extends PluginManagerBase {
|
||||
public function __construct() {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'style');
|
||||
$this->discovery = new ViewsDiscovery('views', 'style');
|
||||
$this->factory = new DefaultFactory($this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,11 @@ namespace Drupal\views\Plugins\Type;
|
|||
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
|
||||
use Drupal\Views\Plugins\Discovery\ViewsDiscovery;
|
||||
|
||||
class WizardPluginManager extends PluginManagerBase {
|
||||
public function __construct() {
|
||||
$this->discovery = new AnnotatedClassDiscovery('views', 'wizard');
|
||||
$this->discovery = new ViewsDiscovery('views', 'wizard');
|
||||
$this->factory = new DefaultFactory($this->discovery);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ use Drupal\Core\Annotation\Translation;
|
|||
|
||||
/**
|
||||
* @Plugin(
|
||||
* plugin_id = "standard",
|
||||
* plugin_id = "default",
|
||||
* title = @Translation("Master"),
|
||||
* help = @Translation("Default settings for this view."),
|
||||
* theme = "views_view",
|
||||
|
|
|
@ -83,6 +83,7 @@ abstract class DisplayPluginBase extends Plugin {
|
|||
unset($options['defaults']);
|
||||
}
|
||||
|
||||
views_include('cache');
|
||||
// Cache for unpack_options, but not if we are in the ui.
|
||||
static $unpack_options = array();
|
||||
if (empty($view->editing)) {
|
||||
|
@ -1212,7 +1213,8 @@ abstract class DisplayPluginBase extends Plugin {
|
|||
}
|
||||
|
||||
if (!empty($style_plugin['uses_row_plugin'])) {
|
||||
$row_plugin = views_fetch_plugin_data('row', $this->get_option('row_plugin'));
|
||||
$manager = views_get_plugin_manager('row');
|
||||
$row_plugin = $manager->getDefinition($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();
|
||||
$row_title = empty($row_plugin['title']) ? t('Missing style plugin') : $row_plugin_instance->plugin_title();
|
||||
|
|
19
views.module
19
views.module
|
@ -884,12 +884,17 @@ function views_add_contextual_links(&$render_element, $location, $view, $display
|
|||
// 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., {""}.)
|
||||
if (!(isset($plugin['contextual_links_locations']) && $plugin['contextual_links_locations'] = array(""))) {
|
||||
$plugin += array('contextual_links_locations' => array('view'));
|
||||
|
||||
if (!isset($plugin['contextual_links_locations'])) {
|
||||
$plugin['contextual_links_locations'] = array('view');
|
||||
}
|
||||
else {
|
||||
elseif ($plugin['contextual_links_locations'] = array() || $plugin['contextual_links_locations'] == array('')) {
|
||||
$plugin['contextual_links_locations'] = array();
|
||||
}
|
||||
else {
|
||||
$plugin += array('contextual_links_locations' => array('view'));
|
||||
}
|
||||
|
||||
// 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']);
|
||||
|
@ -1345,9 +1350,6 @@ function views_fetch_plugin_names($type, $key = NULL, $base = array()) {
|
|||
foreach ($definitions as $plugin_id => $plugin) {
|
||||
if (empty($plugin['no ui']) && (empty($base) || empty($plugin['base']) || array_intersect($base, $plugin['base']))) {
|
||||
$plugins[$plugin_id] = $plugin['title'];
|
||||
if (!isset($plugin['title'])) {
|
||||
dsm($plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1355,6 +1357,7 @@ function views_fetch_plugin_names($type, $key = NULL, $base = array()) {
|
|||
asort($plugins);
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
// fall-through
|
||||
return array();
|
||||
}
|
||||
|
@ -1400,10 +1403,10 @@ function views_get_plugin_manager($type) {
|
|||
case 'row':
|
||||
$manager = new RowPluginManager();
|
||||
break;
|
||||
case 'argument default':
|
||||
case 'argument_default':
|
||||
$manager = new ArgumentDefaultPluginManager();
|
||||
break;
|
||||
case 'argument validator':
|
||||
case 'argument_validator':
|
||||
$manager = new ArgumentValidatorPluginManager();
|
||||
break;
|
||||
case 'access':
|
||||
|
|
|
@ -551,7 +551,7 @@ function views_ui_ctools_plugin_directory($module, $plugin) {
|
|||
*/
|
||||
function views_ui_get_wizard($wizard_type) {
|
||||
ctools_include('plugins');
|
||||
$manager = new WizardManager();
|
||||
$manager = views_get_plugin_manager('wizard');
|
||||
$wizard = $manager->getDefinition($wizard_type);
|
||||
// @todo - handle this via an alter hook instead.
|
||||
if (!$wizard) {
|
||||
|
|
Loading…
Reference in New Issue