diff --git a/core/modules/views/config/schema/views.data_types.schema.yml b/core/modules/views/config/schema/views.data_types.schema.yml index a280d73..3cef265 100644 --- a/core/modules/views/config/schema/views.data_types.schema.yml +++ b/core/modules/views/config/schema/views.data_types.schema.yml @@ -330,9 +330,6 @@ views_handler: provider: type: string label: 'Provider' - optional: - type: boolean - label: 'Optional' views_argument: type: views_handler diff --git a/core/modules/views/src/Entity/View.php b/core/modules/views/src/Entity/View.php index 00098b88..93c446c 100644 --- a/core/modules/views/src/Entity/View.php +++ b/core/modules/views/src/Entity/View.php @@ -268,7 +268,7 @@ public function calculateDependencies() { if (!empty($display['display_options'][$handler_type])) { foreach ($display['display_options'][$handler_type] as $handler) { // Add the provider as dependency. - if (isset($handler['provider']) && empty($handler['optional'])) { + if (isset($handler['provider'])) { $this->addDependency('module', $handler['provider']); } // Add the additional dependencies from the handler configuration. diff --git a/core/modules/views/src/Plugin/ViewsHandlerManager.php b/core/modules/views/src/Plugin/ViewsHandlerManager.php index c3651cf..7b7b76e 100644 --- a/core/modules/views/src/Plugin/ViewsHandlerManager.php +++ b/core/modules/views/src/Plugin/ViewsHandlerManager.php @@ -70,9 +70,6 @@ public function __construct($handler_type, \Traversable $namespaces, ViewsData $ * An associative array representing the handler to be retrieved: * - table: The name of the table containing the handler. * - field: The name of the field the handler represents. - * - optional: (optional) Whether or not this handler is optional. If a - * handler is missing and not optional, a debug message will be displayed. - * Defaults to FALSE. * @param string|null $override * (optional) Override the actual handler object with this plugin ID. Used for * aggregation when the handler is redirected to the aggregation handler. @@ -83,7 +80,6 @@ public function __construct($handler_type, \Traversable $namespaces, ViewsData $ public function getHandler($item, $override = NULL) { $table = $item['table']; $field = $item['field']; - $optional = !empty($item['optional']); // Get the plugin manager for this type. $data = $this->viewsData->get($table); @@ -119,12 +115,8 @@ public function getHandler($item, $override = NULL) { } } - if (!$optional) { - // debug(t("Missing handler: @table @field @type", array('@table' => $table, '@field' => $field, '@type' => $this->handlerType))); - } - // Finally, use the 'broken' handler. - return $this->createInstance('broken', array('optional' => $optional, 'original_configuration' => $item)); + return $this->createInstance('broken', array('original_configuration' => $item)); } /** diff --git a/core/modules/views/src/Plugin/views/HandlerBase.php b/core/modules/views/src/Plugin/views/HandlerBase.php index 979fa4b..e53cf75 100644 --- a/core/modules/views/src/Plugin/views/HandlerBase.php +++ b/core/modules/views/src/Plugin/views/HandlerBase.php @@ -86,13 +86,6 @@ public $relationship = NULL; /** - * Whether or not this handler is optional. - * - * @var bool - */ - protected $optional = FALSE; - - /** * The module handler. * * @var \Drupal\Core\Extension\ModuleHandlerInterface @@ -112,7 +105,6 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->is_handler = TRUE; - $this->optional = !empty($configuration['optional']); } /** @@ -179,15 +171,6 @@ protected function defineOptions() { } /** - * Returns whether this handler is optional. - * - * @return bool - */ - public function isOptional() { - return $this->optional; - } - - /** * Return a string representing this handler's name in the UI. */ public function adminLabel($short = FALSE) { diff --git a/core/modules/views/src/Tests/ModuleTest.php b/core/modules/views/src/Tests/ModuleTest.php index dd976e7..e719a9c 100644 --- a/core/modules/views/src/Tests/ModuleTest.php +++ b/core/modules/views/src/Tests/ModuleTest.php @@ -108,21 +108,11 @@ public function testViewsGetHandler() { $item = array( 'table' => 'table_invalid', 'field' => 'id', - 'optional' => FALSE, ); $this->container->get('plugin.manager.views.filter')->getHandler($item); $this->assertEqual(strpos($this->lastErrorMessage, format_string("Missing handler: @table @field @type", array('@table' => 'table_invalid', '@field' => 'id', '@type' => 'filter'))) !== FALSE, 'An invalid table name throws a debug message.'); unset($this->lastErrorMessage); - $item = array( - 'table' => 'table_invalid', - 'field' => 'id', - 'optional' => TRUE, - ); - $this->container->get('plugin.manager.views.filter')->getHandler($item); - $this->assertFalse($this->lastErrorMessage, "An optional handler does not throw a debug message."); - unset($this->lastErrorMessage); - restore_error_handler(); }