Issue #1931860 by dawehner, damiankloip: Remove plugin_name() property from ViewExecutable.

8.0.x
Alex Pott 2013-05-27 15:48:36 -07:00
parent ff1eea3386
commit 228a2aa35b
3 changed files with 5 additions and 33 deletions

View File

@ -774,8 +774,8 @@ abstract class ArgumentPluginBase extends HandlerBase {
// Change the display style to the summary style for this
// argument.
$this->view->plugin_name = $this->options['summary']['format'];
$this->view->style_options = $this->options['summary_options'];
$this->view->style_plugin = Views::pluginManager("style")->createInstance($this->options['summary']['format']);
$this->view->style_plugin->init($this->view, $this->displayHandler, $this->options['summary_options']);
// Clear out the normal primary field and whatever else may have
// been added and let the summary do the work.

View File

@ -213,14 +213,12 @@ class ViewExecutableTest extends ViewUnitTestBase {
$view->initStyle();
$this->assertTrue($view->style_plugin instanceof DefaultStyle);
$this->assertTrue($view->rowPlugin instanceof Fields);
$this->assertEqual($view->plugin_name, 'default');
$view->setDisplay('page_2');
$view->initStyle();
$this->assertTrue($view->style_plugin instanceof Grid);
// @todo Change this rowPlugin type too.
$this->assertTrue($view->rowPlugin instanceof Fields);
$this->assertEqual($view->plugin_name, 'grid');
}
/**

View File

@ -208,7 +208,7 @@ class ViewExecutable {
/**
* The current used style plugin.
*
* @var Drupal\views\Plugin\views\style\StylePluginBase
* @var \Drupal\views\Plugin\views\style\StylePluginBase
*/
public $style_plugin;
@ -341,24 +341,6 @@ class ViewExecutable {
*/
public $inited;
/**
* The name of the active style plugin of the view.
*
* @todo remove this and just use $this->style_plugin
*
* @var string
*/
public $plugin_name;
/**
* The options used by the style plugin of this running view.
*
* @todo To be able to remove it, Drupal\views\Plugin\views\argument\ArgumentPluginBase::default_summary()
* should instantiate the style plugin.
* @var array
*/
public $style_options;
/**
* The rendered output of the exposed form.
*
@ -709,23 +691,15 @@ class ViewExecutable {
*/
public function initStyle() {
if (isset($this->style_plugin)) {
return is_object($this->style_plugin);
return TRUE;
}
if (!isset($this->plugin_name)) {
$style = $this->display_handler->getOption('style');
$this->plugin_name = $style['type'];
$this->style_options = $style['options'];
}
$this->style_plugin = Views::pluginManager("style")->createInstance($this->plugin_name);
$this->style_plugin = $this->display_handler->getPlugin('style');
if (empty($this->style_plugin)) {
return FALSE;
}
// init the new style handler with data.
$this->style_plugin->init($this, $this->display_handler, $this->style_options);
return TRUE;
}