diff --git a/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php index 3e6ec05..e833fac 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php +++ b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php @@ -12,6 +12,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Plugin\DefaultPluginManager; +use Drupal\views\Plugin\views\HandlerBase; use Drupal\views\ViewsData; use Symfony\Component\DependencyInjection\Container; @@ -58,6 +59,7 @@ public function __construct($handler_type, \Traversable $namespaces, ViewsData $ parent::__construct("Plugin/views/$handler_type", $namespaces, $module_handler, $plugin_definition_annotation_name); $this->setCacheBackend($cache_backend, $language_manager, "views:$handler_type", array('extension' => array(TRUE, 'views'))); + $this->setFallbackPluginId('broken'); $this->viewsData = $views_data; $this->handlerType = $handler_type; @@ -104,30 +106,26 @@ public function getHandler($item, $override = NULL) { } } } - - // @todo This is crazy. Find a way to remove the override functionality. - $plugin_id = $override ? : $definition['id']; - // Try to use the overridden handler. - try { - return $this->createInstance($plugin_id, $definition); - } - catch (PluginException $e) { - // If that fails, use the original handler. - try { - return $this->createInstance($definition['id'], $definition); - } - catch (PluginException $e) { - // Deliberately empty, this case is handled generically below. - } - } } - - if (!$optional) { - // debug(t("Missing handler: @table @field @type", array('@table' => $table, '@field' => $field, '@type' => $this->handlerType))); + else { + $definition = $item; + $definition['id'] = 'non_existing'; } - // Finally, use the 'broken' handler. - return $this->createInstance('broken', array('optional' => $optional, 'original_configuration' => $item)); + // @todo This is crazy. Find a way to remove the override functionality. + $plugin_id = $override ? : $definition['id']; + // Try to use the overridden handler. + try { + return $this->createInstance($plugin_id, $definition); + } + catch (PluginException $e) { + // If that fails, use the original handler / or the broken fallback. + $this->setFallbackPluginId('broken'); + $definition['optional'] = $optional; + $result = $this->createInstance($definition['id'], $definition); + $this->setFallbackPluginId(NULL); + return $result; + } } /** diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/BrokenHandlerTrait.php b/core/modules/views/lib/Drupal/views/Plugin/views/BrokenHandlerTrait.php index e1623f7..9fc5b68 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/BrokenHandlerTrait.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/BrokenHandlerTrait.php @@ -19,7 +19,7 @@ */ public function adminLabel($short = FALSE) { $args = array( - '@module' => $this->definition['original_configuration']['provider'], + '@module' => $this->definition['provider'], ); return $this->isOptional() ? t('Optional handler is missing (Module: @module) …', $args) : t('Broken/missing handler (Module: @module) …', $args); } @@ -64,9 +64,9 @@ public function buildOptionsForm(&$form, &$form_state) { } $items = array( - t('Module: @module', array('@module' => $this->definition['original_configuration']['provider'])), - t('Table: @table', array('@table' => $this->definition['original_configuration']['table'])), - t('Field: @field', array('@field' => $this->definition['original_configuration']['field'])), + t('Module: @module', array('@module' => $this->definition['provider'])), + t('Table: @table', array('@table' => $this->definition['table'])), + t('Field: @field', array('@field' => $this->definition['field'])), ); $description_bottom = t('Enabling the appropriate module will may solve this issue. Otherwise, check to see if there is a module update available.');