Commit 69fa3f16 authored by tim.plunkett's avatar tim.plunkett

Issue #1765704 by tim.plunkett: Fixed calls to getPlugin() bypass the static cache.

parent f18a8d06
......@@ -2172,7 +2172,8 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
break;
case 'field':
// Fetch the style plugin info so we know whether to list fields or not.
$style_plugin = $display->handler->getPlugin();
$name = $display->handler->getOption('style_plugin');
$style_plugin = $display->handler->getPlugin('style', $name);
$uses_fields = $style_plugin && $style_plugin->usesFields();
if (!$uses_fields) {
$build['fields'][] = array(
......
......@@ -763,7 +763,8 @@ public function getOption($option) {
* @return bool
*/
public function usesFields() {
$plugin = $this->getPlugin('style');
$name = $this->getOption('style_plugin');
$plugin = $this->getPlugin('style', $name);
if ($plugin) {
return $plugin->usesFields();
}
......@@ -1116,8 +1117,9 @@ public function optionsSummary(&$categories, &$options) {
);
$manager = new ViewsPluginManager('style');
$style_plugin = $manager->getDefinition($this->getOption('style_plugin'));
$style_plugin_instance = $this->getPlugin('style');
$name = $this->getOption('style_plugin');
$style_plugin = $manager->getDefinition($name);
$style_plugin_instance = $this->getPlugin('style', $name);
$style_summary = empty($style_plugin['title']) ? t('Missing style plugin') : $style_plugin_instance->summaryTitle();
$style_title = empty($style_plugin['title']) ? t('Missing style plugin') : $style_plugin_instance->pluginTitle();
......@@ -1138,8 +1140,9 @@ public function optionsSummary(&$categories, &$options) {
if ($style_plugin_instance->usesRowPlugin()) {
$manager = new ViewsPluginManager('row');
$row_plugin = $manager->getDefinition($this->getOption('row_plugin'));
$row_plugin_instance = $this->getPlugin('row');
$name = $this->getOption('row_plugin');
$row_plugin = $manager->getDefinition($name);
$row_plugin_instance = $this->getPlugin('row', $name);
$row_summary = empty($row_plugin['title']) ? t('Missing style plugin') : $row_plugin_instance->summaryTitle();
$row_title = empty($row_plugin['title']) ? t('Missing style plugin') : $row_plugin_instance->pluginTitle();
......@@ -1645,7 +1648,8 @@ public function buildOptionsForm(&$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 = $this->getPlugin('style');
$name = $this->getOption('style_plugin');
$style_plugin = $this->getPlugin('style', $name);
if ($style_plugin->usesOptions()) {
$form['markup'] = array(
'#markup' => '<div class="form-item description">' . t('You may also adjust the !settings for the currently selected style.', array('!settings' => $this->optionLink(t('settings'), 'style_options'))) . '</div>',
......@@ -1684,7 +1688,8 @@ public function buildOptionsForm(&$form, &$form_state) {
'#default_value' => $this->getOption('row_plugin'),
);
$row_plugin = $this->getPlugin('row');
$name = $this->getOption('row_plugin');
$row_plugin = $this->getPlugin('row', $name);
if ($row_plugin->usesOptions()) {
$form['markup'] = array(
'#markup' => '<div class="form-item description">' . t('You may also adjust the !settings for the currently selected row style.', array('!settings' => $this->optionLink(t('settings'), 'row_options'))) . '</div>',
......@@ -1832,7 +1837,8 @@ public function buildOptionsForm(&$form, &$form_state) {
}
}
$plugin = $this->getPlugin();
$name = $this->getOption('style_plugin');
$plugin = $this->getPlugin('style', $name);
if ($plugin) {
$funcs[] = $this->optionLink(t('Style output'), 'analyze-theme-style') . ': ' . $this->formatThemes($plugin->themeFunctions(), $plugin->additionalThemeFunctions());
$themes = $plugin->additionalThemeFunctions();
......@@ -1843,7 +1849,8 @@ public function buildOptionsForm(&$form, &$form_state) {
}
if ($plugin->usesRowPlugin()) {
$row_plugin = $this->getPlugin('row');
$name = $this->getOption('row_plugin');
$row_plugin = $this->getPlugin('row', $name);
if ($row_plugin) {
$funcs[] = $this->optionLink(t('Row style output'), 'analyze-theme-row') . ': ' . $this->formatThemes($row_plugin->themeFunctions());
$themes = $row_plugin->additionalThemeFunctions();
......@@ -1945,7 +1952,8 @@ public function buildOptionsForm(&$form, &$form_state) {
$form['#title'] .= t('Theming information (style)');
$output = '<p>' . t('Back to !info.', array('!info' => $this->optionLink(t('theming information'), 'analyze-theme'))) . '</p>';
$plugin = $this->getPlugin();
$name = $this->getOption('style_plugin');
$plugin = $this->getPlugin('style', $name);
if (empty($plugin->definition['theme'])) {
$output .= t('This display has no style theming information');
......@@ -1972,7 +1980,8 @@ public function buildOptionsForm(&$form, &$form_state) {
$form['#title'] .= t('Theming information (row style)');
$output = '<p>' . t('Back to !info.', array('!info' => $this->optionLink(t('theming information'), 'analyze-theme'))) . '</p>';
$plugin = $this->getPlugin('row');
$name = $this->getOption('row_plugin');
$plugin = $this->getPlugin('row', $name);
if (empty($plugin->definition['theme'])) {
$output .= t('This display has no row style theming information');
......@@ -2640,7 +2649,8 @@ public function validate() {
}
// Validate style plugin
$style = $this->getPlugin();
$name = $this->getOption('style_plugin');
$style = $this->getPlugin('style', $name);
if (empty($style)) {
$errors[] = t('Display "@display" has an invalid style plugin.', array('@display' => $this->display->display_title));
}
......@@ -2832,7 +2842,8 @@ public function exportHandler($indent, $prefix, $storage, $option, $definition,
*/
public function exportStyle($indent, $prefix, $storage, $option, $definition, $parents) {
$output = '';
$style_plugin = $this->getPlugin();
$name = $this->getOption('style_plugin');
$style_plugin = $this->getPlugin('style', $name);
if ($option == 'style_plugin') {
$type = 'style';
$options_field = 'style_options';
......@@ -2845,7 +2856,8 @@ public function exportStyle($indent, $prefix, $storage, $option, $definition, $p
$type = 'row';
$options_field = 'row_options';
$plugin = $this->getPlugin('row');
$name = $this->getOption('row_plugin');
$plugin = $this->getPlugin('row', $name);
// If the style plugin doesn't use row plugins, don't even bother.
}
......@@ -2893,10 +2905,9 @@ public function exportPlugin($indent, $prefix, $storage, $option, $definition, $
public function unpackStyle($indent, $prefix, $storage, $option, $definition, $parents) {
$output = '';
$style_plugin = $this->getPlugin();
$name = $this->getOption('style_plugin');
$style_plugin = $this->getPlugin('style', $name);
if ($option == 'style_plugin') {
$type = 'style';
$options_field = 'style_options';
$plugin = $style_plugin;
}
else {
......@@ -2904,9 +2915,8 @@ public function unpackStyle($indent, $prefix, $storage, $option, $definition, $p
return;
}
$type = 'row';
$options_field = 'row_options';
$plugin = $this->getPlugin('row');
$name = $this->getOption('row_plugin');
$plugin = $this->getPlugin('row', $name);
// If the style plugin doesn't use row plugins, don't even bother.
}
......
......@@ -240,7 +240,8 @@ public function attachTo($display_id) {
// Defer to the feed style; it may put in meta information, and/or
// attach a feed icon.
$plugin = $this->getPlugin('style');
$name = $this->getOption('style_plugin');
$plugin = $this->getPlugin('style', $name);
if ($plugin) {
$clone = $this->view->cloneView();
$clone->setDisplay($this->display->id);
......
......@@ -661,7 +661,8 @@ public function validate() {
$errors = parent::validate();
if ($this->usesRowPlugin()) {
$plugin = $this->display->handler->getPlugin('row');
$name = $this->display->handler->getOption('row_plugin');
$plugin = $this->display->handler->getPlugin('row', $name);
if (empty($plugin)) {
$errors[] = t('Style @style requires a row style but the row plugin is invalid.', array('@style' => $this->definition['title']));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment