From 01d85e15f2ae52a4393605abf97b26da024534f8 Mon Sep 17 00:00:00 2001
From: webchick <drupal@webchick.net>
Date: Fri, 18 Jul 2014 11:30:01 -0400
Subject: [PATCH] =?UTF-8?q?Issue=20#2301045=20by=20G=C3=A1bor=20Hojtsy:=20?=
 =?UTF-8?q?Fixed=20Standard=20profile=20has=20views=20which=20include=20el?=
 =?UTF-8?q?ements=20dependent=20on=20uninstalled=20modules,=20not=20valid?=
 =?UTF-8?q?=20in=20config.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 core/modules/block/src/BlockBase.php          |  3 +
 .../config/schema/language.views.schema.yml   | 17 ------
 .../config/install/views.view.content.yml     | 27 ---------
 .../node/src/Tests/NodeTranslationUITest.php  | 16 -----
 .../install/views.view.user_admin_people.yml  | 59 -------------------
 .../user/src/Tests/UserTranslationUITest.php  | 15 -----
 .../config/schema/views.argument.schema.yml   |  4 ++
 .../config/schema/views.field.schema.yml      |  4 ++
 .../config/schema/views.filter.schema.yml     |  8 +++
 .../views/argument/LanguageArgument.php       |  6 +-
 .../src/Plugin/views/field/LanguageField.php  |  5 +-
 .../Plugin/views/filter/LanguageFilter.php    |  6 +-
 .../standard/src/Tests/StandardTest.php       | 16 ++++-
 13 files changed, 40 insertions(+), 146 deletions(-)
 delete mode 100644 core/modules/language/config/schema/language.views.schema.yml
 rename core/modules/{language => views}/src/Plugin/views/argument/LanguageArgument.php (86%)
 rename core/modules/{language => views}/src/Plugin/views/field/LanguageField.php (87%)
 rename core/modules/{language => views}/src/Plugin/views/filter/LanguageFilter.php (78%)

diff --git a/core/modules/block/src/BlockBase.php b/core/modules/block/src/BlockBase.php
index eb6b91d97173..707212e31883 100644
--- a/core/modules/block/src/BlockBase.php
+++ b/core/modules/block/src/BlockBase.php
@@ -344,6 +344,9 @@ public function blockForm($form, &$form_state) {
    * @see \Drupal\block\BlockBase::blockValidate()
    */
   public function validateConfigurationForm(array &$form, array &$form_state) {
+    // Remove the admin_label form item element value so it will not persist.
+    unset($form_state['values']['admin_label']);
+
     // Transform the #type = checkboxes value to a numerically indexed array.
     $form_state['values']['cache']['contexts'] = array_values(array_filter($form_state['values']['cache']['contexts']));
 
diff --git a/core/modules/language/config/schema/language.views.schema.yml b/core/modules/language/config/schema/language.views.schema.yml
deleted file mode 100644
index 616a27a031ef..000000000000
--- a/core/modules/language/config/schema/language.views.schema.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-# Schema for the views plugins of the Language module.
-
-views.argument.language:
-  type: views_argument
-  label: 'Language'
-
-views.field.language:
-  type: views_field
-  label: 'Language'
-
-views.filter.language:
-  type: views.filter.in_operator
-  label: 'Language'
-
-views.filter_value.language:
-  type: string
-  label: 'Language'
diff --git a/core/modules/node/config/install/views.view.content.yml b/core/modules/node/config/install/views.view.content.yml
index 4b95eb3cbc99..f01eb21c530f 100644
--- a/core/modules/node/config/install/views.view.content.yml
+++ b/core/modules/node/config/install/views.view.content.yml
@@ -53,7 +53,6 @@ display:
             changed: changed
             edit_node: edit_node
             delete_node: delete_node
-            translation_link: translation_link
             dropbutton: dropbutton
             timestamp: title
           info:
@@ -111,13 +110,6 @@ display:
               separator: ''
               empty_column: false
               responsive: ''
-            translation_link:
-              sortable: false
-              default_sort_order: asc
-              align: ''
-              separator: ''
-              empty_column: false
-              responsive: ''
             dropbutton:
               sortable: false
               default_sort_order: asc
@@ -268,24 +260,6 @@ display:
           text: Delete
           plugin_id: node_link_delete
           provider: node
-        translation_link:
-          id: translation_link
-          table: node
-          field: translation_link
-          label: ''
-          exclude: true
-          alter:
-            alter_text: false
-          element_class: ''
-          element_default_classes: true
-          hide_alter_empty: true
-          hide_empty: false
-          empty_zero: false
-          empty: ''
-          text: Translate
-          optional: true
-          plugin_id: content_translation_link
-          provider: content_translation
         dropbutton:
           id: dropbutton
           table: views
@@ -294,7 +268,6 @@ display:
           fields:
             edit_node: edit_node
             delete_node: delete_node
-            translation_link: translation_link
           destination: true
           plugin_id: dropbutton
           provider: views
diff --git a/core/modules/node/src/Tests/NodeTranslationUITest.php b/core/modules/node/src/Tests/NodeTranslationUITest.php
index b6dde0372cd1..ea4cb9f5a838 100644
--- a/core/modules/node/src/Tests/NodeTranslationUITest.php
+++ b/core/modules/node/src/Tests/NodeTranslationUITest.php
@@ -173,22 +173,6 @@ protected function doTestAuthoringInfo() {
     }
   }
 
-  /**
-   * Tests translate link on content admin page.
-   */
-  function testTranslateLinkContentAdminPage() {
-    $this->drupalLogin($this->administrator);
-
-    $page = $this->drupalCreateNode(array('type' => 'page'));
-    $article = $this->drupalCreateNode(array('type' => 'article', 'langcode' => $this->langcodes[0]));
-
-    // Verify translation links.
-    $this->drupalGet('admin/content');
-    $this->assertResponse(200);
-    $this->assertLinkByHref('node/' . $article->id() . '/translations');
-    $this->assertNoLinkByHref('node/' . $page->id() . '/translations');
-  }
-
   /**
    * Tests that translation page inherits admin status of edit page.
    */
diff --git a/core/modules/user/config/install/views.view.user_admin_people.yml b/core/modules/user/config/install/views.view.user_admin_people.yml
index e08752eae723..963303fe163a 100644
--- a/core/modules/user/config/install/views.view.user_admin_people.yml
+++ b/core/modules/user/config/install/views.view.user_admin_people.yml
@@ -77,7 +77,6 @@ display:
             created: created
             access: access
             edit_node: edit_node
-            translation_link: translation_link
             dropbutton: dropbutton
           info:
             user_bulk_form:
@@ -125,11 +124,6 @@ display:
               separator: ''
               empty_column: false
               responsive: priority-low
-            translation_link:
-              align: ''
-              separator: ''
-              empty_column: false
-              responsive: ''
             dropbutton:
               sortable: false
               default_sort_order: asc
@@ -511,58 +505,6 @@ display:
           text: Edit
           plugin_id: user_link_edit
           provider: user
-        translation_link:
-          id: translation_link
-          table: users
-          field: translation_link
-          relationship: none
-          group_type: group
-          admin_label: ''
-          label: 'Translation link'
-          exclude: true
-          alter:
-            alter_text: false
-            text: ''
-            make_link: false
-            path: ''
-            absolute: false
-            external: false
-            replace_spaces: false
-            path_case: none
-            trim_whitespace: false
-            alt: ''
-            rel: ''
-            link_class: ''
-            prefix: ''
-            suffix: ''
-            target: ''
-            nl2br: false
-            max_length: ''
-            word_boundary: true
-            ellipsis: true
-            more_link: false
-            more_link_text: ''
-            more_link_path: ''
-            strip_tags: false
-            trim: false
-            preserve_tags: ''
-            html: false
-          element_type: ''
-          element_class: ''
-          element_label_type: ''
-          element_label_class: ''
-          element_label_colon: true
-          element_wrapper_type: ''
-          element_wrapper_class: ''
-          element_default_classes: true
-          empty: ''
-          hide_empty: false
-          empty_zero: false
-          hide_alter_empty: true
-          text: Translate
-          optional: true
-          plugin_id: content_translation_link
-          provider: content_translation
         dropbutton:
           id: dropbutton
           table: views
@@ -613,7 +555,6 @@ display:
           hide_alter_empty: true
           fields:
             edit_node: edit_node
-            translation_link: translation_link
             user_bulk_form: '0'
             name: '0'
             status: '0'
diff --git a/core/modules/user/src/Tests/UserTranslationUITest.php b/core/modules/user/src/Tests/UserTranslationUITest.php
index d8c83326f4bd..c5b6a8faa028 100644
--- a/core/modules/user/src/Tests/UserTranslationUITest.php
+++ b/core/modules/user/src/Tests/UserTranslationUITest.php
@@ -52,19 +52,4 @@ protected function getNewEntityValues($langcode) {
     return array('name' => $this->name) + parent::getNewEntityValues($langcode);
   }
 
-  /**
-   * Tests translate link on user admin list.
-   */
-  function testTranslateLinkUserAdminPage() {
-    $this->admin_user = $this->drupalCreateUser(array_merge(parent::getTranslatorPermissions(), array('access administration pages', 'administer users')));
-    $this->drupalLogin($this->admin_user);
-
-    $uid = $this->createEntity(array('name' => $this->randomName()), $this->langcodes[0]);
-
-    // Verify translation links.
-    $this->drupalGet('admin/people');
-    $this->assertResponse(200);
-    $this->assertLinkByHref('user/' . $uid . '/translations');
-  }
-
 }
diff --git a/core/modules/views/config/schema/views.argument.schema.yml b/core/modules/views/config/schema/views.argument.schema.yml
index 92aa47792f1a..8d9a3b47d7fe 100644
--- a/core/modules/views/config/schema/views.argument.schema.yml
+++ b/core/modules/views/config/schema/views.argument.schema.yml
@@ -143,3 +143,7 @@ views.argument.date_year_month:
     created:
       type: string
       label: 'Date Year month'
+
+views.argument.language:
+  type: views_argument
+  label: 'Language'
diff --git a/core/modules/views/config/schema/views.field.schema.yml b/core/modules/views/config/schema/views.field.schema.yml
index 595461bcaa12..c515361856ff 100644
--- a/core/modules/views/config/schema/views.field.schema.yml
+++ b/core/modules/views/config/schema/views.field.schema.yml
@@ -174,3 +174,7 @@ views.field.url:
 views.field.xss:
   type: views_field
   label: 'Xss'
+
+views.field.language:
+  type: views_field
+  label: 'Language'
diff --git a/core/modules/views/config/schema/views.filter.schema.yml b/core/modules/views/config/schema/views.filter.schema.yml
index 4f4f77a6b0c5..537ba81e63ee 100644
--- a/core/modules/views/config/schema/views.filter.schema.yml
+++ b/core/modules/views/config/schema/views.filter.schema.yml
@@ -140,3 +140,11 @@ views.filter_value.boolean:
 
 views.filter_value.combine:
   type: string
+
+views.filter.language:
+  type: views.filter.in_operator
+  label: 'Language'
+
+views.filter_value.language:
+  type: string
+  label: 'Language'
diff --git a/core/modules/language/src/Plugin/views/argument/LanguageArgument.php b/core/modules/views/src/Plugin/views/argument/LanguageArgument.php
similarity index 86%
rename from core/modules/language/src/Plugin/views/argument/LanguageArgument.php
rename to core/modules/views/src/Plugin/views/argument/LanguageArgument.php
index 1366a0fe53f1..c73ca6b14906 100644
--- a/core/modules/language/src/Plugin/views/argument/LanguageArgument.php
+++ b/core/modules/views/src/Plugin/views/argument/LanguageArgument.php
@@ -2,12 +2,10 @@
 
 /**
  * @file
- * Contains Drupal\language\Plugin\views\argument\LanguageArgument.
+ * Contains Drupal\views\Plugin\views\argument\LanguageArgument.
  */
 
-namespace Drupal\language\Plugin\views\argument;
-
-use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
+namespace Drupal\views\Plugin\views\argument;
 
 /**
  * Defines an argument handler to accept a language.
diff --git a/core/modules/language/src/Plugin/views/field/LanguageField.php b/core/modules/views/src/Plugin/views/field/LanguageField.php
similarity index 87%
rename from core/modules/language/src/Plugin/views/field/LanguageField.php
rename to core/modules/views/src/Plugin/views/field/LanguageField.php
index 3909fcd0ae45..7c6c35c937e2 100644
--- a/core/modules/language/src/Plugin/views/field/LanguageField.php
+++ b/core/modules/views/src/Plugin/views/field/LanguageField.php
@@ -2,12 +2,11 @@
 
 /**
  * @file
- * Contains Drupal\language\Plugin\views\field\LanguageField.
+ * Contains Drupal\views\Plugin\views\field\LanguageField.
  */
 
-namespace Drupal\language\Plugin\views\field;
+namespace Drupal\views\Plugin\views\field;
 
-use Drupal\views\Plugin\views\field\FieldPluginBase;
 use Drupal\views\ResultRow;
 
 /**
diff --git a/core/modules/language/src/Plugin/views/filter/LanguageFilter.php b/core/modules/views/src/Plugin/views/filter/LanguageFilter.php
similarity index 78%
rename from core/modules/language/src/Plugin/views/filter/LanguageFilter.php
rename to core/modules/views/src/Plugin/views/filter/LanguageFilter.php
index d03ea6fb6c8d..8b08f3335f1f 100644
--- a/core/modules/language/src/Plugin/views/filter/LanguageFilter.php
+++ b/core/modules/views/src/Plugin/views/filter/LanguageFilter.php
@@ -2,12 +2,10 @@
 
 /**
  * @file
- * Contains Drupal\language\Plugin\views\filter\LanguageFilter.
+ * Contains Drupal\views\Plugin\views\filter\LanguageFilter.
  */
 
-namespace Drupal\language\Plugin\views\filter;
-
-use Drupal\views\Plugin\views\filter\InOperator;
+namespace Drupal\views\Plugin\views\filter;
 
 /**
  * Provides filtering by language.
diff --git a/core/profiles/standard/src/Tests/StandardTest.php b/core/profiles/standard/src/Tests/StandardTest.php
index a8d4724ae4b4..9977e6421f74 100644
--- a/core/profiles/standard/src/Tests/StandardTest.php
+++ b/core/profiles/standard/src/Tests/StandardTest.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\standard\Tests;
 
-use Drupal\comment\Entity\Comment;
+use Drupal\config\Tests\SchemaCheckTestTrait;
 use Drupal\simpletest\WebTestBase;
 
 /**
@@ -17,6 +17,8 @@
  */
 class StandardTest extends WebTestBase {
 
+  use SchemaCheckTestTrait;
+
   protected $profile = 'standard';
 
   /**
@@ -86,6 +88,18 @@ function testStandard() {
     $this->drupalGet('rss.xml');
     $this->assertText('Foobar');
     $this->assertNoText('Then she picked out two somebodies, Sally and me');
+
+    // Now we have all configuration imported, test all of them for schema
+    // conformance. Ensures all imported default configuration is valid when
+    // standard profile modules are enabled.
+    $names = $this->container->get('config.storage')->listAll();
+    $factory = $this->container->get('config.factory');
+    /** @var \Drupal\Core\Config\TypedConfigManagerInterface $typed_config */
+    $typed_config = $this->container->get('config.typed');
+    foreach ($names as $name) {
+      $config = $factory->get($name);
+      $this->assertConfigSchema($typed_config, $name, $config->get());
+    }
   }
 
 }
-- 
GitLab