Find and initialize the style plugin.
Note that arguments may have changed which style plugin we use, so check the view object first, then ask the display handler.
public function initStyle() {
if (isset($this->style_plugin)) {
return is_object($this->style_plugin);
}
if (!isset($this->plugin_name)) {
$style = $this->display_handler
->getOption('style');
$this->plugin_name = $style['type'];
$this->style_options = $style['options'];
}
$this->style_plugin = drupal_container()
->get("plugin.manager.views.style")
->createInstance($this->plugin_name);
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;
}