diff --git a/core/lib/Drupal/Core/Field/FieldItemBase.php b/core/lib/Drupal/Core/Field/FieldItemBase.php index bedcce9..df016b9 100644 --- a/core/lib/Drupal/Core/Field/FieldItemBase.php +++ b/core/lib/Drupal/Core/Field/FieldItemBase.php @@ -47,7 +47,7 @@ public static function storageSettingsSummary(FieldStorageConfigInterface $field public static function fieldSettingsSummary(FieldConfigInterface $field_config) { $definitions = \Drupal::service('plugin.manager.field.field_type')->getDefinitions(); return [ - t('Field type: @type', [ + t('@type', [ '@type' => $definitions[$field_config->getFieldStorageDefinition()->getType()]['label'], ]), ]; diff --git a/core/modules/field_ui/src/FieldConfigListBuilder.php b/core/modules/field_ui/src/FieldConfigListBuilder.php index 94e2f88..454c34b 100644 --- a/core/modules/field_ui/src/FieldConfigListBuilder.php +++ b/core/modules/field_ui/src/FieldConfigListBuilder.php @@ -107,7 +107,7 @@ public function buildHeader() { 'data' => $this->t('Machine name'), 'class' => [RESPONSIVE_PRIORITY_MEDIUM], ], - 'settings_summary' => $this->t('Summary'), + 'settings_summary' => $this->t('Field type'), ]; return $header + parent::buildHeader(); } diff --git a/core/modules/field_ui/tests/src/Functional/ManageFieldsTest.php b/core/modules/field_ui/tests/src/Functional/ManageFieldsTest.php index 1c21b06..1f2001d 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageFieldsTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageFieldsTest.php @@ -5,7 +5,7 @@ use Drupal\Tests\BrowserTestBase; /** - * Tests the Manage Display page of a fieldable entity type. + * Tests the Manage Fields page of a fieldable entity type. * * @group field_ui */ @@ -33,8 +33,15 @@ protected function setUp() { ->save(); } - public function testFieldDropButtonOperations() { + /** + * Tests the Manage Fields page of a fieldable entity type + */ + public function testFieldUiManageFields() { + $page = $this->getSession()->getPage(); + $assert_session = $this->assertSession(); + $node_type = $this->drupalCreateContentType(); + $bundle = $node_type->id(); /** @var \Drupal\field\FieldStorageConfigInterface $storage */ $storage = $this->container->get('entity_type.manager') @@ -50,12 +57,52 @@ public function testFieldDropButtonOperations() { ->getStorage('field_config') ->create([ 'field_storage' => $storage, - 'bundle' => $node_type->id(), + 'bundle' => $bundle, ]) ->save(); - $this->drupalGet('/admin/structure/types/manage/' . $node_type->id() . '/fields'); + $this->drupalGet('/admin/structure/types/manage/' . $bundle . '/fields'); + + // Check that the summary element for the string field type exists and has + // the correct text (which comes from the FieldItemBase class). + $element = $assert_session->elementExists('css', '#highlander'); + $summary = $assert_session->elementExists('css', '.field-plugin-summary b', $element); + $field_label = $this->container->get('plugin.manager.field.field_type')->getDefinitions()['string']['label']; + $this->assertEquals($field_label, $summary->getText()); + + // Add an entity reference field, and check that its summary is custom. + /** @var \Drupal\field\FieldStorageConfigInterface $storage */ + $storage = $this->container->get('entity_type.manager') + ->getStorage('field_storage_config') + ->create([ + 'type' => 'entity_reference', + 'field_name' => 'downlander', + 'entity_type' => 'node', + 'settings' => [ + 'target_type' => 'node', + ], + ]); + $storage->save(); + + $this->container->get('entity_type.manager') + ->getStorage('field_config') + ->create([ + 'field_storage' => $storage, + 'bundle' => $bundle, + 'entity_type' => 'node', + 'settings' => [ + 'handler_settings' => [ + 'target_bundles' => [$bundle => $bundle], + ], + ], + ]) + ->save(); + $this->drupalGet('/admin/structure/types/manage/' . $bundle . '/fields'); + $element = $assert_session->elementExists('css', '#downlander'); + $summary = $assert_session->elementExists('css', '.field-plugin-summary', $element); + $custom_summary_text = 'Referenced entity type: Content'; + $this->assertContains($custom_summary_text, $summary->getText()); } } diff --git a/core/modules/system/tests/src/Functional/Update/UpdatePathRC1TestBaseFilledTest.php b/core/modules/system/tests/src/Functional/Update/UpdatePathRC1TestBaseFilledTest.php index 7573fc4..5cec1f1 100644 --- a/core/modules/system/tests/src/Functional/Update/UpdatePathRC1TestBaseFilledTest.php +++ b/core/modules/system/tests/src/Functional/Update/UpdatePathRC1TestBaseFilledTest.php @@ -25,6 +25,8 @@ protected function setDatabaseDumpFiles() { * Tests that the content and configuration were properly updated. */ public function testUpdatedSite() { + $assert_session = $this->assertSession(); + $this->runUpdates(); $spanish = \Drupal::languageManager()->getLanguage('es'); @@ -228,24 +230,24 @@ public function testUpdatedSite() { $this->drupalGet('admin/structure/types/manage/test_content_type/fields'); // Make sure fields are the right type. - $this->assertLink('Text (formatted, long, with summary)'); - $this->assertLink('Boolean'); - $this->assertLink('Comments'); - $this->assertLink('Date'); - $this->assertLink('Email'); - $this->assertLink('Link'); - $this->assertLink('List (float)'); - $this->assertLink('Telephone number'); - $this->assertLink('Entity reference'); - $this->assertLink('File'); - $this->assertLink('Image'); - $this->assertLink('Text (plain, long)'); - $this->assertLink('List (text)'); - $this->assertLink('Text (formatted, long)'); - $this->assertLink('Text (plain)'); - $this->assertLink('List (integer)'); - $this->assertLink('Number (integer)'); - $this->assertLink('Number (float)'); + $assert_session->pageTextContains('Text (formatted, long, with summary)'); + $assert_session->pageTextContains('Boolean'); + $assert_session->pageTextContains('Comments'); + $assert_session->pageTextContains('Date'); + $assert_session->pageTextContains('Email'); + $assert_session->pageTextContains('Link'); + $assert_session->pageTextContains('List (float)'); + $assert_session->pageTextContains('Telephone number'); + $assert_session->pageTextContains('Entity reference'); + $assert_session->pageTextContains('File'); + $assert_session->pageTextContains('Image'); + $assert_session->pageTextContains('Text (plain, long)'); + $assert_session->pageTextContains('List (text)'); + $assert_session->pageTextContains('Text (formatted, long)'); + $assert_session->pageTextContains('Text (plain)'); + $assert_session->pageTextContains('List (integer)'); + $assert_session->pageTextContains('Number (integer)'); + $assert_session->pageTextContains('Number (float)'); // Make sure our form mode exists. $this->drupalGet('admin/structure/display-modes/form'); diff --git a/core/modules/system/tests/src/Functional/Update/UpdatePathTestBaseFilledTest.php b/core/modules/system/tests/src/Functional/Update/UpdatePathTestBaseFilledTest.php index 2ed58fb..2a8d068 100644 --- a/core/modules/system/tests/src/Functional/Update/UpdatePathTestBaseFilledTest.php +++ b/core/modules/system/tests/src/Functional/Update/UpdatePathTestBaseFilledTest.php @@ -26,6 +26,8 @@ protected function setDatabaseDumpFiles() { * Tests that the content and configuration were properly updated. */ public function testUpdatedSite() { + $assert_session = $this->assertSession(); + $this->runUpdates(); $spanish = \Drupal::languageManager()->getLanguage('es'); @@ -229,24 +231,24 @@ public function testUpdatedSite() { $this->drupalGet('admin/structure/types/manage/test_content_type/fields'); // Make sure fields are the right type. - $this->assertLink('Text (formatted, long, with summary)'); - $this->assertLink('Boolean'); - $this->assertLink('Comments'); - $this->assertLink('Date'); - $this->assertLink('Email'); - $this->assertLink('Link'); - $this->assertLink('List (float)'); - $this->assertLink('Telephone number'); - $this->assertLink('Entity reference'); - $this->assertLink('File'); - $this->assertLink('Image'); - $this->assertLink('Text (plain, long)'); - $this->assertLink('List (text)'); - $this->assertLink('Text (formatted, long)'); - $this->assertLink('Text (plain)'); - $this->assertLink('List (integer)'); - $this->assertLink('Number (integer)'); - $this->assertLink('Number (float)'); + $assert_session->pageTextContains('Text (formatted, long, with summary)'); + $assert_session->pageTextContains('Boolean'); + $assert_session->pageTextContains('Comments'); + $assert_session->pageTextContains('Date'); + $assert_session->pageTextContains('Email'); + $assert_session->pageTextContains('Link'); + $assert_session->pageTextContains('List (float)'); + $assert_session->pageTextContains('Telephone number'); + $assert_session->pageTextContains('Entity reference'); + $assert_session->pageTextContains('File'); + $assert_session->pageTextContains('Image'); + $assert_session->pageTextContains('Text (plain, long)'); + $assert_session->pageTextContains('List (text)'); + $assert_session->pageTextContains('Text (formatted, long)'); + $assert_session->pageTextContains('Text (plain)'); + $assert_session->pageTextContains('List (integer)'); + $assert_session->pageTextContains('Number (integer)'); + $assert_session->pageTextContains('Number (float)'); // Make sure our form mode exists. $this->drupalGet('admin/structure/display-modes/form');