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

8.0.x
Tim Plunkett 2012-08-31 13:37:21 -04:00
parent f18a8d0677
commit 69fa3f1657
4 changed files with 36 additions and 23 deletions

View File

@ -2172,7 +2172,8 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
break; break;
case 'field': case 'field':
// Fetch the style plugin info so we know whether to list fields or not. // 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(); $uses_fields = $style_plugin && $style_plugin->usesFields();
if (!$uses_fields) { if (!$uses_fields) {
$build['fields'][] = array( $build['fields'][] = array(

View File

@ -763,7 +763,8 @@ abstract class DisplayPluginBase extends PluginBase {
* @return bool * @return bool
*/ */
public function usesFields() { public function usesFields() {
$plugin = $this->getPlugin('style'); $name = $this->getOption('style_plugin');
$plugin = $this->getPlugin('style', $name);
if ($plugin) { if ($plugin) {
return $plugin->usesFields(); return $plugin->usesFields();
} }
@ -1116,8 +1117,9 @@ abstract class DisplayPluginBase extends PluginBase {
); );
$manager = new ViewsPluginManager('style'); $manager = new ViewsPluginManager('style');
$style_plugin = $manager->getDefinition($this->getOption('style_plugin')); $name = $this->getOption('style_plugin');
$style_plugin_instance = $this->getPlugin('style'); $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_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(); $style_title = empty($style_plugin['title']) ? t('Missing style plugin') : $style_plugin_instance->pluginTitle();
@ -1138,8 +1140,9 @@ abstract class DisplayPluginBase extends PluginBase {
if ($style_plugin_instance->usesRowPlugin()) { if ($style_plugin_instance->usesRowPlugin()) {
$manager = new ViewsPluginManager('row'); $manager = new ViewsPluginManager('row');
$row_plugin = $manager->getDefinition($this->getOption('row_plugin')); $name = $this->getOption('row_plugin');
$row_plugin_instance = $this->getPlugin('row'); $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_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(); $row_title = empty($row_plugin['title']) ? t('Missing style plugin') : $row_plugin_instance->pluginTitle();
@ -1645,7 +1648,8 @@ abstract class DisplayPluginBase extends PluginBase {
'#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.'), '#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()) { if ($style_plugin->usesOptions()) {
$form['markup'] = array( $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>', '#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 @@ abstract class DisplayPluginBase extends PluginBase {
'#default_value' => $this->getOption('row_plugin'), '#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()) { if ($row_plugin->usesOptions()) {
$form['markup'] = array( $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>', '#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 @@ abstract class DisplayPluginBase extends PluginBase {
} }
} }
$plugin = $this->getPlugin(); $name = $this->getOption('style_plugin');
$plugin = $this->getPlugin('style', $name);
if ($plugin) { if ($plugin) {
$funcs[] = $this->optionLink(t('Style output'), 'analyze-theme-style') . ': ' . $this->formatThemes($plugin->themeFunctions(), $plugin->additionalThemeFunctions()); $funcs[] = $this->optionLink(t('Style output'), 'analyze-theme-style') . ': ' . $this->formatThemes($plugin->themeFunctions(), $plugin->additionalThemeFunctions());
$themes = $plugin->additionalThemeFunctions(); $themes = $plugin->additionalThemeFunctions();
@ -1843,7 +1849,8 @@ abstract class DisplayPluginBase extends PluginBase {
} }
if ($plugin->usesRowPlugin()) { if ($plugin->usesRowPlugin()) {
$row_plugin = $this->getPlugin('row'); $name = $this->getOption('row_plugin');
$row_plugin = $this->getPlugin('row', $name);
if ($row_plugin) { if ($row_plugin) {
$funcs[] = $this->optionLink(t('Row style output'), 'analyze-theme-row') . ': ' . $this->formatThemes($row_plugin->themeFunctions()); $funcs[] = $this->optionLink(t('Row style output'), 'analyze-theme-row') . ': ' . $this->formatThemes($row_plugin->themeFunctions());
$themes = $row_plugin->additionalThemeFunctions(); $themes = $row_plugin->additionalThemeFunctions();
@ -1945,7 +1952,8 @@ abstract class DisplayPluginBase extends PluginBase {
$form['#title'] .= t('Theming information (style)'); $form['#title'] .= t('Theming information (style)');
$output = '<p>' . t('Back to !info.', array('!info' => $this->optionLink(t('theming information'), 'analyze-theme'))) . '</p>'; $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'])) { if (empty($plugin->definition['theme'])) {
$output .= t('This display has no style theming information'); $output .= t('This display has no style theming information');
@ -1972,7 +1980,8 @@ abstract class DisplayPluginBase extends PluginBase {
$form['#title'] .= t('Theming information (row style)'); $form['#title'] .= t('Theming information (row style)');
$output = '<p>' . t('Back to !info.', array('!info' => $this->optionLink(t('theming information'), 'analyze-theme'))) . '</p>'; $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'])) { if (empty($plugin->definition['theme'])) {
$output .= t('This display has no row style theming information'); $output .= t('This display has no row style theming information');
@ -2640,7 +2649,8 @@ abstract class DisplayPluginBase extends PluginBase {
} }
// Validate style plugin // Validate style plugin
$style = $this->getPlugin(); $name = $this->getOption('style_plugin');
$style = $this->getPlugin('style', $name);
if (empty($style)) { if (empty($style)) {
$errors[] = t('Display "@display" has an invalid style plugin.', array('@display' => $this->display->display_title)); $errors[] = t('Display "@display" has an invalid style plugin.', array('@display' => $this->display->display_title));
} }
@ -2832,7 +2842,8 @@ abstract class DisplayPluginBase extends PluginBase {
*/ */
public function exportStyle($indent, $prefix, $storage, $option, $definition, $parents) { public function exportStyle($indent, $prefix, $storage, $option, $definition, $parents) {
$output = ''; $output = '';
$style_plugin = $this->getPlugin(); $name = $this->getOption('style_plugin');
$style_plugin = $this->getPlugin('style', $name);
if ($option == 'style_plugin') { if ($option == 'style_plugin') {
$type = 'style'; $type = 'style';
$options_field = 'style_options'; $options_field = 'style_options';
@ -2845,7 +2856,8 @@ abstract class DisplayPluginBase extends PluginBase {
$type = 'row'; $type = 'row';
$options_field = 'row_options'; $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. // If the style plugin doesn't use row plugins, don't even bother.
} }
@ -2893,10 +2905,9 @@ abstract class DisplayPluginBase extends PluginBase {
public function unpackStyle($indent, $prefix, $storage, $option, $definition, $parents) { public function unpackStyle($indent, $prefix, $storage, $option, $definition, $parents) {
$output = ''; $output = '';
$style_plugin = $this->getPlugin(); $name = $this->getOption('style_plugin');
$style_plugin = $this->getPlugin('style', $name);
if ($option == 'style_plugin') { if ($option == 'style_plugin') {
$type = 'style';
$options_field = 'style_options';
$plugin = $style_plugin; $plugin = $style_plugin;
} }
else { else {
@ -2904,9 +2915,8 @@ abstract class DisplayPluginBase extends PluginBase {
return; return;
} }
$type = 'row'; $name = $this->getOption('row_plugin');
$options_field = 'row_options'; $plugin = $this->getPlugin('row', $name);
$plugin = $this->getPlugin('row');
// If the style plugin doesn't use row plugins, don't even bother. // If the style plugin doesn't use row plugins, don't even bother.
} }

View File

@ -240,7 +240,8 @@ class Feed extends Page {
// Defer to the feed style; it may put in meta information, and/or // Defer to the feed style; it may put in meta information, and/or
// attach a feed icon. // attach a feed icon.
$plugin = $this->getPlugin('style'); $name = $this->getOption('style_plugin');
$plugin = $this->getPlugin('style', $name);
if ($plugin) { if ($plugin) {
$clone = $this->view->cloneView(); $clone = $this->view->cloneView();
$clone->setDisplay($this->display->id); $clone->setDisplay($this->display->id);

View File

@ -661,7 +661,8 @@ abstract class StylePluginBase extends PluginBase {
$errors = parent::validate(); $errors = parent::validate();
if ($this->usesRowPlugin()) { 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)) { if (empty($plugin)) {
$errors[] = t('Style @style requires a row style but the row plugin is invalid.', array('@style' => $this->definition['title'])); $errors[] = t('Style @style requires a row style but the row plugin is invalid.', array('@style' => $this->definition['title']));
} }