diff --git a/core/modules/comment/src/Plugin/views/wizard/Comment.php b/core/modules/comment/src/Plugin/views/wizard/Comment.php index 2d3b2b5..14ebb1d 100644 --- a/core/modules/comment/src/Plugin/views/wizard/Comment.php +++ b/core/modules/comment/src/Plugin/views/wizard/Comment.php @@ -43,6 +43,7 @@ class Comment extends WizardPluginBase { 'alter_text' => TRUE, 'text' => 'comment/[cid]#comment-[cid]' ), + 'plugin_id' => 'comment', ); /** @@ -53,15 +54,15 @@ class Comment extends WizardPluginBase { 'value' => TRUE, 'table' => 'comment_field_data', 'field' => 'status', - 'provider' => 'comment' + 'plugin_id' => 'boolean', ), 'status_node' => array( 'value' => TRUE, 'table' => 'node_field_data', 'field' => 'status', - 'provider' => 'node', + 'plugin_id' => 'boolean', 'relationship' => 'node', - ) + ), ); /** @@ -168,6 +169,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['subject']['hide_empty'] = 0; $display_options['fields']['subject']['empty_zero'] = 0; $display_options['fields']['subject']['link_to_comment'] = 1; + $display_options['fields']['subject']['plugin_id'] = 'comment'; return $display_options; } diff --git a/core/modules/file/src/Plugin/views/wizard/File.php b/core/modules/file/src/Plugin/views/wizard/File.php index 0539ccf..0d54945 100644 --- a/core/modules/file/src/Plugin/views/wizard/File.php +++ b/core/modules/file/src/Plugin/views/wizard/File.php @@ -33,7 +33,8 @@ class File extends WizardPluginBase { 'table' => 'file_managed', 'field' => 'uri', 'exclude' => TRUE, - 'file_download_path' => TRUE + 'file_download_path' => TRUE, + 'plugin_id' => 'file_uri', ); /** @@ -64,6 +65,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['filename']['hide_empty'] = 0; $display_options['fields']['filename']['empty_zero'] = 0; $display_options['fields']['filename']['link_to_file'] = 1; + $display_options['fields']['filename']['plugin_id'] = 'file'; return $display_options; } diff --git a/core/modules/node/config/schema/node.views.schema.yml b/core/modules/node/config/schema/node.views.schema.yml index 0b16f94..942e89b 100644 --- a/core/modules/node/config/schema/node.views.schema.yml +++ b/core/modules/node/config/schema/node.views.schema.yml @@ -157,7 +157,7 @@ views.field.node_path: label: 'Use absolute link (begins with "http://")' views.field.node_revision: - type: views_field + type: views.field.node label: 'Node revision' mapping: link_to_node_revision: diff --git a/core/modules/node/src/Plugin/views/wizard/Node.php b/core/modules/node/src/Plugin/views/wizard/Node.php index 2ce97ca..d8f4b32 100644 --- a/core/modules/node/src/Plugin/views/wizard/Node.php +++ b/core/modules/node/src/Plugin/views/wizard/Node.php @@ -42,7 +42,8 @@ class Node extends WizardPluginBase { 'alter' => array( 'alter_text' => TRUE, 'text' => 'node/[nid]' - ) + ), + 'plugin_id' => 'node', ); /** @@ -53,7 +54,7 @@ class Node extends WizardPluginBase { 'value' => TRUE, 'table' => 'node_field_data', 'field' => 'status', - 'provider' => 'node' + 'plugin_id' => 'boolean' ) ); @@ -148,6 +149,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['title']['hide_empty'] = 0; $display_options['fields']['title']['empty_zero'] = 0; $display_options['fields']['title']['link_to_node'] = 1; + $display_options['fields']['title']['plugin_id'] = 'node'; return $display_options; } diff --git a/core/modules/node/src/Plugin/views/wizard/NodeRevision.php b/core/modules/node/src/Plugin/views/wizard/NodeRevision.php index 3297b1c..82ad93a 100644 --- a/core/modules/node/src/Plugin/views/wizard/NodeRevision.php +++ b/core/modules/node/src/Plugin/views/wizard/NodeRevision.php @@ -40,7 +40,8 @@ class NodeRevision extends WizardPluginBase { 'alter' => array( 'alter_text' => TRUE, 'text' => 'node/[nid]/revisions/[vid]/view' - ) + ), + 'plugin_id' => 'node_revision', ); /** @@ -52,7 +53,8 @@ class NodeRevision extends WizardPluginBase { 'table' => 'node', 'field' => 'nid', 'exclude' => TRUE, - 'link_to_node' => FALSE + 'link_to_node' => FALSE, + 'plugin_id' => 'node', ) ); @@ -64,7 +66,7 @@ class NodeRevision extends WizardPluginBase { 'value' => TRUE, 'table' => 'node_field_revision', 'field' => 'status', - 'provider' => 'node' + 'plugin_id' => 'boolean' ) ); @@ -88,7 +90,7 @@ protected function defaultDisplayOptions() { // Add permission-based access control. $display_options['access']['type'] = 'perm'; - $display_options['access']['perm'] = 'view revisions'; + $display_options['access']['options']['perm'] = 'view revisions'; // Remove the default fields, since we are customizing them here. unset($display_options['fields']); @@ -107,6 +109,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['changed']['alter']['html'] = FALSE; $display_options['fields']['changed']['hide_empty'] = FALSE; $display_options['fields']['changed']['empty_zero'] = FALSE; + $display_options['fields']['changed']['plugin_id'] = 'date'; /* Field: Content revision: Title */ $display_options['fields']['title']['id'] = 'title'; @@ -125,6 +128,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['title']['empty_zero'] = 0; $display_options['fields']['title']['link_to_node'] = 0; $display_options['fields']['title']['link_to_node_revision'] = 1; + $display_options['fields']['title']['plugin_id'] = 'node_revision'; return $display_options; } diff --git a/core/modules/taxonomy/src/Plugin/views/wizard/TaxonomyTerm.php b/core/modules/taxonomy/src/Plugin/views/wizard/TaxonomyTerm.php index 10a42ac..e7d3046 100644 --- a/core/modules/taxonomy/src/Plugin/views/wizard/TaxonomyTerm.php +++ b/core/modules/taxonomy/src/Plugin/views/wizard/TaxonomyTerm.php @@ -31,7 +31,8 @@ class TaxonomyTerm extends WizardPluginBase { 'alter' => array( 'alter_text' => TRUE, 'text' => 'taxonomy/term/[tid]' - ) + ), + 'plugin_id' => 'taxonomy', ); /** @@ -62,6 +63,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['name']['hide_empty'] = 0; $display_options['fields']['name']['empty_zero'] = 0; $display_options['fields']['name']['link_to_taxonomy'] = 1; + $display_options['fields']['name']['plugin_id'] = 'taxonomy'; return $display_options; } diff --git a/core/modules/user/src/Plugin/views/wizard/Users.php b/core/modules/user/src/Plugin/views/wizard/Users.php index 92b29a9..d715dc1 100644 --- a/core/modules/user/src/Plugin/views/wizard/Users.php +++ b/core/modules/user/src/Plugin/views/wizard/Users.php @@ -41,7 +41,8 @@ class Users extends WizardPluginBase { 'alter' => array( 'alter_text' => TRUE, 'text' => 'user/[uid]' - ) + ), + 'plugin_id' => 'user', ); /** @@ -52,7 +53,7 @@ class Users extends WizardPluginBase { 'value' => TRUE, 'table' => 'users_field_data', 'field' => 'status', - 'provider' => 'user' + 'plugin_id' => 'boolean', ) ); @@ -64,7 +65,7 @@ protected function defaultDisplayOptions() { // Add permission-based access control. $display_options['access']['type'] = 'perm'; - $display_options['access']['perm'] = 'access user profiles'; + $display_options['access']['options']['perm'] = 'access user profiles'; // Remove the default fields, since we are customizing them here. unset($display_options['fields']); @@ -86,6 +87,7 @@ protected function defaultDisplayOptions() { $display_options['fields']['name']['empty_zero'] = 0; $display_options['fields']['name']['link_to_user'] = 1; $display_options['fields']['name']['overwrite_anonymous'] = 0; + $display_options['fields']['name']['plugin_id'] = 'user_name'; return $display_options; } diff --git a/core/modules/views/config/schema/views.schema.yml b/core/modules/views/config/schema/views.schema.yml index 66abe11..61a6ea5 100644 --- a/core/modules/views/config/schema/views.schema.yml +++ b/core/modules/views/config/schema/views.schema.yml @@ -114,3 +114,14 @@ views.view.*: label: 'Position' display_options: type: views.display.[%parent.display_plugin] + +block.settings.views_block:*: + type: block_settings + label: 'View block' + mapping: + views_label: + type: label + lable: 'Title' + items_per_page: + type: string + label: 'Items per block' diff --git a/core/modules/views/src/Plugin/Block/ViewsBlockBase.php b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php index 4736fbc..953dfae 100644 --- a/core/modules/views/src/Plugin/Block/ViewsBlockBase.php +++ b/core/modules/views/src/Plugin/Block/ViewsBlockBase.php @@ -171,6 +171,7 @@ public function blockSubmit($form, FormStateInterface $form_state) { else { $this->configuration['views_label'] = ''; } + $form_state->unsetValue('views_label_checkbox'); } /** diff --git a/core/modules/views/src/Plugin/views/display/Block.php b/core/modules/views/src/Plugin/views/display/Block.php index 2c41598..d2bfe26 100644 --- a/core/modules/views/src/Plugin/views/display/Block.php +++ b/core/modules/views/src/Plugin/views/display/Block.php @@ -332,6 +332,7 @@ public function blockSubmit(ViewsBlock $block, $form, FormStateInterface $form_s if ($items_per_page = $form_state->getValue(array('override', 'items_per_page'))) { $block->setConfigurationValue('items_per_page', $items_per_page); } + $form_state->unsetValue(array('override', 'items_per_page')); } /** diff --git a/core/modules/views/src/Tests/NewViewConfigSchemaTest.php b/core/modules/views/src/Tests/NewViewConfigSchemaTest.php new file mode 100644 index 0000000..7ee6862 --- /dev/null +++ b/core/modules/views/src/Tests/NewViewConfigSchemaTest.php @@ -0,0 +1,51 @@ +drupalLogin($this->drupalCreateUser(array('administer views'))); + + // Create views with all core Views wizards. + $wizards = array('node', 'node_revision', 'users', 'comment', 'file_managed', 'taxonomy_term', 'watchdog'); + foreach($wizards as $wizard_key) { + $edit = array(); + $edit['label'] = $this->randomString(); + $edit['id'] = strtolower($this->randomMachineName()); + $edit['show[wizard_key]'] = $wizard_key; + $edit['description'] = $this->randomString(); + $this->drupalPostForm('admin/structure/views/add', $edit, t('Save and edit')); + } + } + +} diff --git a/core/modules/views/src/Tests/Wizard/WizardTestBase.php b/core/modules/views/src/Tests/Wizard/WizardTestBase.php index 0a2e998..16907b8 100644 --- a/core/modules/views/src/Tests/Wizard/WizardTestBase.php +++ b/core/modules/views/src/Tests/Wizard/WizardTestBase.php @@ -15,6 +15,15 @@ abstract class WizardTestBase extends ViewTestBase { /** + * Set to TRUE to strict check all configuration saved. + * + * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker + * + * @var bool + */ + protected $strictConfigSchema = TRUE; + + /** * Modules to enable. * * @var array