diff --git a/core/modules/node/config/install/views.view.content.yml b/core/modules/node/config/install/views.view.content.yml index f01eb21..3ea06e7 100644 --- a/core/modules/node/config/install/views.view.content.yml +++ b/core/modules/node/config/install/views.view.content.yml @@ -321,7 +321,6 @@ display: hide_alter_empty: true link_to_node: false comments: false - optional: true plugin_id: history_user_timestamp provider: history filters: @@ -473,7 +472,6 @@ display: identifier: langcode remember_roles: authenticated: authenticated - optional: true plugin_id: language provider: language sorts: { } diff --git a/core/modules/node/config/install/views.view.content_recent.yml b/core/modules/node/config/install/views.view.content_recent.yml index 07afd74..8e231b2 100644 --- a/core/modules/node/config/install/views.view.content_recent.yml +++ b/core/modules/node/config/install/views.view.content_recent.yml @@ -206,7 +206,6 @@ display: hide_alter_empty: true link_to_node: false comments: false - optional: true plugin_id: history_user_timestamp provider: history name: 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/BrokenHandlerTrait.php b/core/modules/views/src/Plugin/views/BrokenHandlerTrait.php index e1623f7..0800f80 100644 --- a/core/modules/views/src/Plugin/views/BrokenHandlerTrait.php +++ b/core/modules/views/src/Plugin/views/BrokenHandlerTrait.php @@ -21,7 +21,7 @@ public function adminLabel($short = FALSE) { $args = array( '@module' => $this->definition['original_configuration']['provider'], ); - return $this->isOptional() ? t('Optional handler is missing (Module: @module) …', $args) : t('Broken/missing handler (Module: @module) …', $args); + return t('Broken/missing handler (Module: @module) …', $args); } /** 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(); } diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_optional.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_optional.yml index de319fe..2f6fe29 100644 --- a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_optional.yml +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_view_optional.yml @@ -10,79 +10,6 @@ display: pager: '0' pager_options: '0' sorts: '0' - fields: - id_optional: - field: id_optional - id: id_optional - relationship: none - table: views_test_data - plugin_id: numeric - optional: 1 - provider: views - filters: - id_optional: - field: id_optional - id: id_optional - relationship: none - table: views_test_data - plugin_id: numeric - optional: 1 - provider: views - arguments: - id_optional: - field: id_optional - id: id_optional - relationship: none - table: views_test_data - plugin_id: numeric - optional: 1 - provider: views - sorts: - id_optional: - field: id_optional - id: id_optional - relationship: none - table: views_test_data - plugin_id: numeric - order: ASC - optional: 1 - provider: views - relationships: - id_optional: - field: id_optional - id: id_optional - relationship: none - table: views_test_data - plugin_id: numeric - optional: 1 - provider: views - header: - id_optional: - field: id_optional - id: id_optional - relationship: none - table: views_test_data - plugin_id: numeric - optional: 1 - provider: views - footer: - id_optional: - field: id_optional - id: id_optional - relationship: none - table: views_test_data - plugin_id: numeric - optional: 1 - provider: views - empty: - id_optional: - field: id_optional - id: id_optional - relationship: none - table: views_test_data - plugin_id: numeric - optional: 1 - provider: views pager: options: offset: '0'