diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 7e311d9..94d5e5d 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1490,8 +1490,6 @@ function template_preprocess_region(&$variables) { * - element: A render element representing the field. * - attributes: A string containing the attributes for the wrapping div. * - title_attributes: A string containing the attributes for the title. - * - content_attributes: A string containing the attributes for the content's - * div. */ function template_preprocess_field(&$variables, $hook) { $element = $variables['element']; @@ -1508,11 +1506,21 @@ function template_preprocess_field(&$variables, $hook) { // readers. $variables['label'] = SafeMarkup::checkPlain($element['#title']); + $variables['multiple'] = FALSE; + if ($itemsDefinition = $element['#items']->getFieldDefinition()) { + $variables['multiple'] = $itemsDefinition->getFieldStorageDefinition()->isMultiple(); + } + static $default_attributes; if (!isset($default_attributes)) { $default_attributes = new Attribute; } + // Merge attributes when a single-value field has a hidden label. + if ($element['#label_display'] == 'hidden' && !$variables['multiple'] && is_object($element['#items'][0])) { + $variables['attributes'] = NestedArray::mergeDeep($variables['attributes'], (array) $element['#items'][0]->_attributes); + } + // We want other preprocess functions and the theme implementation to have // fast access to the field item render arrays. The item render array keys // (deltas) should always be numerically indexed starting from 0, and looping diff --git a/core/lib/Drupal/Core/Field/WidgetBase.php b/core/lib/Drupal/Core/Field/WidgetBase.php index 356eece..a58d05c 100644 --- a/core/lib/Drupal/Core/Field/WidgetBase.php +++ b/core/lib/Drupal/Core/Field/WidgetBase.php @@ -128,9 +128,9 @@ public function form(FieldItemListInterface $items, array &$form, FormStateInter '#parents' => array_merge($parents, array($field_name . '_wrapper')), '#attributes' => array( 'class' => array( - 'field-type-' . Html::getClass($this->fieldDefinition->getType()), - 'field-name-' . Html::getClass($field_name), - 'field-widget-' . Html::getClass($this->getPluginId()), + 'field--type-' . Html::getClass($this->fieldDefinition->getType()), + 'field--name-' . Html::getClass($field_name), + 'field--widget-' . Html::getClass($this->getPluginId()), ), ), 'widget' => $elements, diff --git a/core/modules/comment/src/Tests/CommentFieldsTest.php b/core/modules/comment/src/Tests/CommentFieldsTest.php index ede2e91..85d3206 100644 --- a/core/modules/comment/src/Tests/CommentFieldsTest.php +++ b/core/modules/comment/src/Tests/CommentFieldsTest.php @@ -84,13 +84,13 @@ public function testCommentFieldDelete() { $this->drupalLogin($this->webUser); $this->drupalGet('node/' . $node->nid->value); - $elements = $this->cssSelect('.field-type-comment'); + $elements = $this->cssSelect('.field--type-comment'); $this->assertEqual(2, count($elements), 'There are two comment fields on the node.'); // Delete the first comment field. FieldStorageConfig::loadByName('node', 'comment')->delete(); $this->drupalGet('node/' . $node->nid->value); - $elements = $this->cssSelect('.field-type-comment'); + $elements = $this->cssSelect('.field--type-comment'); $this->assertEqual(1, count($elements), 'There is one comment field on the node.'); } diff --git a/core/modules/editor/js/editor.formattedTextEditor.js b/core/modules/editor/js/editor.formattedTextEditor.js index 6ad38b9..73014e8 100644 --- a/core/modules/editor/js/editor.formattedTextEditor.js +++ b/core/modules/editor/js/editor.formattedTextEditor.js @@ -62,7 +62,7 @@ // Store the actual value of this field. We'll need this to restore the // original value when the user discards his modifications. - this.$textElement = this.$el.find('.field-item').eq(0); + this.$textElement = this.$el.find('.field__item').eq(0); this.model.set('originalValue', this.$textElement.html()); }, diff --git a/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php b/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php index 2364a8a..31f2c05 100644 --- a/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php +++ b/core/modules/field/src/Tests/Boolean/BooleanFieldTest.php @@ -115,7 +115,7 @@ function testBooleanField() { $display = entity_get_display($entity->getEntityTypeId(), $entity->bundle(), 'full'); $content = $display->build($entity); $this->setRawContent(\Drupal::service('renderer')->renderRoot($content)); - $this->assertRaw('
' . $on . '
'); + $this->assertRaw('
' . $on . '
'); // Test if we can change the on label. $on = $this->randomMachineName(); diff --git a/core/modules/field/src/Tests/DisplayApiTest.php b/core/modules/field/src/Tests/DisplayApiTest.php index 6fc8174..eff812b 100644 --- a/core/modules/field/src/Tests/DisplayApiTest.php +++ b/core/modules/field/src/Tests/DisplayApiTest.php @@ -119,6 +119,9 @@ protected function setUp() { function testFieldItemListView() { $items = $this->entity->get($this->fieldName); + \Drupal::service('theme_handler')->install(['classy']); + $this->config('system.theme')->set('default', 'classy')->save(); + // No display settings: check that default display settings are used. $build = $items->view(); $this->render($build); diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php index 3c7b9d6..c897764 100644 --- a/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php +++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php @@ -72,6 +72,10 @@ class EntityReferenceFormatterTest extends EntityUnitTestBase { protected function setUp() { parent::setUp(); + // Use Classy theme for testing markup output. + \Drupal::service('theme_handler')->install(['classy']); + $this->config('system.theme')->set('default', 'classy')->save(); + // Grant the 'view test entity' permission. $this->installConfig(array('user')); Role::load(RoleInterface::ANONYMOUS_ID) @@ -185,18 +189,14 @@ public function testEntityFormatter() { $build = $this->buildRenderArray([$this->referencedEntity, $this->unsavedReferencedEntity], $formatter); // Test the first field item. - $expected_rendered_name_field_1 = '
-
-
' . $this->referencedEntity->label() . '
-
-
-'; - $expected_rendered_body_field_1 = '
-
Body
-
-

Hello, world!

-
-
+ $expected_rendered_name_field_1 = ' +
' . $this->referencedEntity->label() . '
+ '; + $expected_rendered_body_field_1 = ' +
+
Body
+

Hello, world!

+
'; $renderer->renderRoot($build[0]); $this->assertEqual($build[0]['#markup'], 'default | ' . $this->referencedEntity->label() . $expected_rendered_name_field_1 . $expected_rendered_body_field_1, sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter)); diff --git a/core/modules/image/src/Tests/ImageFieldDisplayTest.php b/core/modules/image/src/Tests/ImageFieldDisplayTest.php index 1e1d798..c4cf485 100644 --- a/core/modules/image/src/Tests/ImageFieldDisplayTest.php +++ b/core/modules/image/src/Tests/ImageFieldDisplayTest.php @@ -337,7 +337,7 @@ function testImageFieldDefaultImage() { $this->drupalGet('node/' . $node->id()); // Verify that no image is displayed on the page by checking for the class // that would be used on the image field. - $this->assertNoPattern('
', 'No image displayed when no image is attached and no default image specified.'); + $this->assertNoPattern('
', 'No image displayed when no image is attached and no default image specified.'); $cache_tags_header = $this->drupalGetHeader('X-Drupal-Cache-Tags'); $this->assertTrue(!preg_match('/ image_style\:/', $cache_tags_header), 'No image style cache tag found.'); diff --git a/core/modules/node/node.js b/core/modules/node/node.js index af2ed46..ebb22ff 100644 --- a/core/modules/node/node.js +++ b/core/modules/node/node.js @@ -31,8 +31,8 @@ $context.find('.node-form-author').drupalSetSummary(function (context) { var $authorContext = $(context); - var name = $authorContext.find('.field-name-uid input').val(); - var date = $authorContext.find('.field-name-created input').val(); + var name = $authorContext.find('.field--name-uid input').val(); + var date = $authorContext.find('.field--name-created input').val(); return date ? Drupal.t('By @name on @date', {'@name': name, '@date': date}) : Drupal.t('By @name', {'@name': name}); diff --git a/core/modules/node/src/Tests/NodeViewTest.php b/core/modules/node/src/Tests/NodeViewTest.php index c60d44a..ed400ea 100644 --- a/core/modules/node/src/Tests/NodeViewTest.php +++ b/core/modules/node/src/Tests/NodeViewTest.php @@ -41,7 +41,7 @@ public function testMultiByteUtf8() { $this->assertTrue(mb_strlen($title, 'utf-8') < strlen($title), 'Title has multi-byte characters.'); $node = $this->drupalCreateNode(array('title' => $title)); $this->drupalGet($node->urlInfo()); - $result = $this->xpath('//span[contains(@class, "field-name-title")]'); + $result = $this->xpath('//span[contains(@class, "field--name-title")]'); $this->assertEqual((string) $result[0], $title, 'The passed title was returned.'); } diff --git a/core/modules/quickedit/js/editors/plainTextEditor.js b/core/modules/quickedit/js/editors/plainTextEditor.js index 4e43d61..8a51fc6 100644 --- a/core/modules/quickedit/js/editors/plainTextEditor.js +++ b/core/modules/quickedit/js/editors/plainTextEditor.js @@ -30,7 +30,7 @@ // Store the original value of this field. Necessary for reverting // changes. var $textElement; - var $fieldItems = this.$el.find('.field-item'); + var $fieldItems = this.$el.find('.field__item'); if ($fieldItems.length) { $textElement = this.$textElement = $fieldItems.eq(0); } diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index 1beb1a1..fa53333 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -268,6 +268,18 @@ function rdf_preprocess_html(&$variables) { } /** + * Implements hook_preprocess_HOOK() for field templates. + */ +function rdf_preprocess_field(&$variables) { + // Swap the regular field property attribute and use rel instead so that it + // plays well with the RDFa markup generated for the username. + if (!empty($variables['attributes']['property']) && $variables['field_type'] == 'entity_reference' && $variables['field_name'] == 'uid') { + $variables['attributes']['rel'] = $variables['attributes']['property']; + unset($variables['attributes']['property']); + } +} + +/** * Implements hook_preprocess_HOOK() for node templates. */ function rdf_preprocess_node(&$variables) { @@ -294,12 +306,6 @@ function rdf_preprocess_node(&$variables) { ); } - // Adds RDFa markup for the relation between the node and its author. - $author_mapping = $mapping->getPreparedFieldMapping('uid'); - if (!empty($author_mapping['properties']) && $variables['display_submitted']) { - $variables['author_attributes']['rel'] = $author_mapping['properties']; - } - // Adds RDFa markup for the date. $created_mapping = $mapping->getPreparedFieldMapping('created'); if (!empty($created_mapping) && $variables['display_submitted']) { diff --git a/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php b/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php index f5974bb..120d6f0 100644 --- a/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php +++ b/core/modules/rdf/src/Tests/Field/NumberFieldRdfaTest.php @@ -24,7 +24,7 @@ public function testIntegerFormatter() { $this->assertFormatterRdfa(array('type' => 'number_integer'), 'http://schema.org/baseSalary', array('value' => $testValue)); // Test that the content attribute is not created. - $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field-item") and @content]'); + $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field__items") and @content]'); $this->assertFalse($result); } @@ -32,6 +32,8 @@ public function testIntegerFormatter() { * Tests the integer formatter with settings. */ public function testIntegerFormatterWithSettings() { + \Drupal::service('theme_handler')->install(['classy']); + $this->config('system.theme')->set('default', 'classy')->save(); $this->fieldType = 'integer'; $formatter = array( 'type' => 'number_integer', @@ -50,7 +52,7 @@ public function testIntegerFormatterWithSettings() { $this->assertFormatterRdfa($formatter, 'http://schema.org/baseSalary', array('value' => $testValue)); // Test that the content attribute is created. - $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field-item") and @content=:testValue]', array(':testValue' => $testValue)); + $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field__item") and @content=:testValue]', array(':testValue' => $testValue)); $this->assertTrue($result); } @@ -65,7 +67,7 @@ public function testFloatFormatter() { $this->assertFormatterRdfa(array('type' => 'number_unformatted'), 'http://schema.org/baseSalary', array('value' => $testValue)); // Test that the content attribute is not created. - $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field-item") and @content]'); + $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field__items") and @content]'); $this->assertFalse($result); } @@ -73,6 +75,8 @@ public function testFloatFormatter() { * Tests the float formatter with settings. */ public function testFloatFormatterWithSettings() { + \Drupal::service('theme_handler')->install(['classy']); + $this->config('system.theme')->set('default', 'classy')->save(); $this->fieldType = 'float'; $formatter = array( 'type' => 'number_decimal', @@ -92,7 +96,7 @@ public function testFloatFormatterWithSettings() { $this->assertFormatterRdfa($formatter, 'http://schema.org/baseSalary', array('value' => $testValue)); // Test that the content attribute is created. - $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field-item") and @content=:testValue]', array(':testValue' => $testValue)); + $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field__item") and @content=:testValue]', array(':testValue' => $testValue)); $this->assertTrue($result); } @@ -113,7 +117,7 @@ public function testFloatFormatterWithScale() { $this->assertFormatterRdfa($formatter, 'http://schema.org/baseSalary', array('value' => $testValue)); // Test that the content attribute is not created. - $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field-item") and @content]'); + $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field__items") and @content]'); $this->assertFalse($result); } @@ -121,6 +125,8 @@ public function testFloatFormatterWithScale() { * Tests the float formatter with a scale. Scale is exercised. */ public function testFloatFormatterWithScaleExercised() { + \Drupal::service('theme_handler')->install(['classy']); + $this->config('system.theme')->set('default', 'classy')->save(); $this->fieldType = 'float'; $formatter = array( 'type' => 'number_decimal', @@ -134,7 +140,7 @@ public function testFloatFormatterWithScaleExercised() { $this->assertFormatterRdfa($formatter, 'http://schema.org/baseSalary', array('value' => $testValue)); // Test that the content attribute is created. - $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field-item") and @content=:testValue]', array(':testValue' => $testValue)); + $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field__item") and @content=:testValue]', array(':testValue' => $testValue)); $this->assertTrue($result); } @@ -149,7 +155,7 @@ public function testDecimalFormatter() { $this->assertFormatterRdfa(array('type' => 'number_decimal'), 'http://schema.org/baseSalary', array('value' => $testValue)); // Test that the content attribute is not created. - $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field-item") and @content]'); + $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field__items") and @content]'); $this->assertFalse($result); } @@ -157,6 +163,8 @@ public function testDecimalFormatter() { * Tests the decimal formatter with settings. */ public function testDecimalFormatterWithSettings() { + \Drupal::service('theme_handler')->install(['classy']); + $this->config('system.theme')->set('default', 'classy')->save(); $this->fieldType = 'decimal'; $formatter = array( 'type' => 'number_decimal', @@ -176,7 +184,7 @@ public function testDecimalFormatterWithSettings() { $this->assertFormatterRdfa($formatter, 'http://schema.org/baseSalary', array('value' => $testValue)); // Test that the content attribute is created. - $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field-item") and @content=:testValue]', array(':testValue' => $testValue)); + $result = $this->xpathContent($this->getRawContent(), '//div[contains(@class, "field__item") and @content=:testValue]', array(':testValue' => $testValue)); $this->assertTrue($result); } diff --git a/core/modules/rdf/src/Tests/StandardProfileTest.php b/core/modules/rdf/src/Tests/StandardProfileTest.php index 784bd80..d94f40b 100644 --- a/core/modules/rdf/src/Tests/StandardProfileTest.php +++ b/core/modules/rdf/src/Tests/StandardProfileTest.php @@ -107,6 +107,10 @@ class StandardProfileTest extends WebTestBase { protected function setUp() { parent::setUp(); + // Use Classy theme for testing markup output. + \Drupal::service('theme_handler')->install(['classy']); + $this->config('system.theme')->set('default', 'classy')->save(); + $this->baseUri = \Drupal::url('', [], ['absolute' => TRUE]); // Create two test users. diff --git a/core/modules/search/src/Tests/SearchExcerptTest.php b/core/modules/search/src/Tests/SearchExcerptTest.php index 9ed4403..01dd620 100644 --- a/core/modules/search/src/Tests/SearchExcerptTest.php +++ b/core/modules/search/src/Tests/SearchExcerptTest.php @@ -69,7 +69,7 @@ function testSearchExcerpt() { // The node body that will produce this rendered $text is: // 123456789 HTMLTest +123456789+‘ +‘ +‘ +‘ +12345678    +‘ +‘ +‘ ‘ - $text = "

123456789 HTMLTest +123456789+‘ +‘ +‘ +‘ +12345678    +‘ +‘ +‘ ‘

\n
"; + $text = "

123456789 HTMLTest +123456789+‘ +‘ +‘ +‘ +12345678 +‘ +‘ +‘ ‘

\n
"; $result = search_excerpt('HTMLTest', $text); $this->assertFalse(empty($result), 'Rendered Multi-byte HTML encodings are not corrupted in search excerpts'); } diff --git a/core/modules/system/css/components/field.theme.css b/core/modules/system/css/components/field.theme.css old mode 100644 new mode 100755 index 89a16aa..0ef4c2d --- a/core/modules/system/css/components/field.theme.css +++ b/core/modules/system/css/components/field.theme.css @@ -3,20 +3,23 @@ * Visual styles for fields. */ -.field .field-label { +.field__label { font-weight: bold; } -.field-label-inline .field-label, -.field-label-inline .field-items { - float:left; /*LTR*/ - margin-right: 0.5em; /*LTR*/ +.field--label-inline .field__label, +.field--label-inline .field__items { + float: left; /*LTR*/ } -[dir="rtl"] .field-label-inline .field-label, -[dir="rtl"] .field-label-inline .field-items { - float: right; - margin-left: 0.5em; - margin-right: 0; +.field--label-inline .field__label, +.field--label-inline > .field__item, +.field--label-inline .field__items { + padding-right: 0.5em; } -.field-label-inline .field-label::after { +[dir="rtl"] .field--label-inline .field__label, +[dir="rtl"] .field--label-inline .field__items { + padding-left: 0.5em; + padding-right: 0; +} +.field--label-inline .field__label::after { content: ':'; } diff --git a/core/modules/system/src/Tests/Ajax/MultiFormTest.php b/core/modules/system/src/Tests/Ajax/MultiFormTest.php index 5c3a60a..f87100d 100644 --- a/core/modules/system/src/Tests/Ajax/MultiFormTest.php +++ b/core/modules/system/src/Tests/Ajax/MultiFormTest.php @@ -60,7 +60,7 @@ function testMultiForm() { $field_name = 'field_ajax_test'; $form_xpath = '//form[starts-with(@id, "node-page-form")]'; - $field_xpath = '//div[contains(@class, "field-name-field-ajax-test")]'; + $field_xpath = '//div[contains(@class, "field--name-field-ajax-test")]'; $button_name = $field_name . '_add_more'; $button_value = t('Add another item'); $button_xpath_suffix = '//input[@name="' . $button_name . '"]'; diff --git a/core/modules/system/src/Tests/Entity/EntityViewControllerTest.php b/core/modules/system/src/Tests/Entity/EntityViewControllerTest.php index 362f269..a80b984 100644 --- a/core/modules/system/src/Tests/Entity/EntityViewControllerTest.php +++ b/core/modules/system/src/Tests/Entity/EntityViewControllerTest.php @@ -46,12 +46,9 @@ protected function setUp() { */ function testEntityViewController() { $get_label_markup = function($label) { - return '

-
-
' . $label . '
-
-
-

'; + return '

+
' . $label . '
+

'; }; foreach ($this->entities as $entity) { diff --git a/core/modules/system/src/Tests/Form/RebuildTest.php b/core/modules/system/src/Tests/Form/RebuildTest.php index 9826070..ddb86ae 100644 --- a/core/modules/system/src/Tests/Form/RebuildTest.php +++ b/core/modules/system/src/Tests/Form/RebuildTest.php @@ -97,7 +97,7 @@ function testPreserveFormActionAfterAJAX() { // field items in the field for which we just added an item. $this->drupalGet('node/add/page'); $this->drupalPostAjaxForm(NULL, array(), array('field_ajax_test_add_more' => t('Add another item')), NULL, array(), array(), 'node-page-form'); - $this->assert(count($this->xpath('//div[contains(@class, "field-name-field-ajax-test")]//input[@type="text"]')) == 2, 'AJAX submission succeeded.'); + $this->assert(count($this->xpath('//div[contains(@class, "field--name-field-ajax-test")]//input[@type="text"]')) == 2, 'AJAX submission succeeded.'); // Submit the form with the non-Ajax "Save" button, leaving the title field // blank to trigger a validation error, and ensure that a validation error diff --git a/core/modules/system/templates/field.html.twig b/core/modules/system/templates/field.html.twig index 0745f84..1b78574 100644 --- a/core/modules/system/templates/field.html.twig +++ b/core/modules/system/templates/field.html.twig @@ -1,7 +1,7 @@ {# /** * @file - * Default theme implementation for a field. + * Theme override for a field. * * To override output, copy the "field.html.twig" from the templates directory * to your theme's directory and customize it, just like customizing other @@ -24,7 +24,7 @@ * - label_hidden: Whether to show the field label or not. * - title_attributes: HTML attributes for the title. * - label: The label for the field. - * - content_attributes: HTML attributes for the content. + * - multiple: TRUE if a field can contain multiple items. * - items: List of all the field items. Each item contains: * - attributes: List of HTML attributes for each item. * - content: The field item's content. @@ -33,35 +33,34 @@ * - field_type: The type of the field. * - label_display: The display settings for the label. * - * @see template_preprocess_field() * - * @ingroup themeable + * @see template_preprocess_field() */ #} -{% set field_name_class = field_name|clean_class %} -{% - set classes = [ - 'field', - 'field-' ~ entity_type|clean_class ~ '--' ~ field_name_class, - 'field-name-' ~ field_name_class, - 'field-type-' ~ field_type|clean_class, - 'field-label-' ~ label_display, - label_display == 'inline' ? 'clearfix', - ] -%} -{% - set title_classes = [ - 'field-label', - label_display == 'visually_hidden' ? 'visually-hidden', - ] -%} - - {% if not label_hidden %} - {{ label }}
+ +{% if label_hidden %} + {% if multiple %} + + {% for item in items %} + {{ item.content }}
+ {% endfor %} + + {% else %} + {% for item in items %} + {{ item.content }} + {% endfor %} {% endif %} - +{% else %} + + {{ label }} + {% if multiple %} +
+ {% endif %} {% for item in items %} - {{ item.content }}
+ {{ item.content }} {% endfor %} + {% if multiple %} + + {% endif %} - +{% endif %} diff --git a/core/modules/taxonomy/src/Tests/TermTest.php b/core/modules/taxonomy/src/Tests/TermTest.php index 09a0de2..3af85d8 100644 --- a/core/modules/taxonomy/src/Tests/TermTest.php +++ b/core/modules/taxonomy/src/Tests/TermTest.php @@ -339,12 +339,12 @@ function testTermInterface() { $this->assertText($edit['description[0][value]'], 'The randomly generated term description is present.'); // Did this page request display a 'term-listing-heading'? - $this->assertTrue($this->xpath('//div[contains(@class, "field-taxonomy-term--description")]'), 'Term page displayed the term description element.'); + $this->assertTrue($this->xpath('//div[contains(@class, "field--name-description")]'), 'Term page displayed the term description element.'); // Check that it does NOT show a description when description is blank. $term->setDescription(NULL); $term->save(); $this->drupalGet('taxonomy/term/' . $term->id()); - $this->assertFalse($this->xpath('//div[contains(@class, "field-taxonomy-term--description")]'), 'Term page did not display the term description when description was blank.'); + $this->assertFalse($this->xpath('//div[contains(@class, "field--entity-taxonomy-term--description")]'), 'Term page did not display the term description when description was blank.'); // Check that the description value is processed. $value = $this->randomMachineName(); diff --git a/core/modules/views/src/Tests/Handler/FieldWebTest.php b/core/modules/views/src/Tests/Handler/FieldWebTest.php index 3ffec6b..0435809 100644 --- a/core/modules/views/src/Tests/Handler/FieldWebTest.php +++ b/core/modules/views/src/Tests/Handler/FieldWebTest.php @@ -400,7 +400,7 @@ public function testFieldClasses() { $output = $view->preview(); $output = $renderer->renderRoot($output); $this->assertFalse($this->xpathContent($output, '//div[contains(@class, :class)]', array(':class' => 'field-content'))); - $this->assertFalse($this->xpathContent($output, '//div[contains(@class, :class)]', array(':class' => 'field-label'))); + $this->assertFalse($this->xpathContent($output, '//div[contains(@class, :class)]', array(':class' => 'field__label'))); $id_field->options['element_default_classes'] = TRUE; $output = $view->preview(); diff --git a/core/themes/bartik/css/components/comments.css b/core/themes/bartik/css/components/comments.css index 8515cd9..4b9980e 100644 --- a/core/themes/bartik/css/components/comments.css +++ b/core/themes/bartik/css/components/comments.css @@ -29,8 +29,8 @@ .comment__attribution img { border: 1px solid #d3d7d9; } -/* This is required to win over specificity of .field-type-image img */ -.comment .field-name-user-picture img { +/* This is required to win over specificity of .field--type-image img */ +.comment .field--name-user-picture img { margin: 0; } .comment__author .username { diff --git a/core/themes/bartik/css/components/content.css b/core/themes/bartik/css/components/content.css index cf436e8..850323f 100644 --- a/core/themes/bartik/css/components/content.css +++ b/core/themes/bartik/css/components/content.css @@ -87,47 +87,47 @@ h1#page-title { color: #68696b; margin-bottom: -5px; } -.node__meta .field-name-field-user-picture img { +.node__meta .field--name-field-user-picture img { float: left; /* LTR */ margin: 1px 20px 0 0; /* LTR */ } -[dir="rtl"] .node__meta .field-name-field-user-picture img { +[dir="rtl"] .node__meta .field--name-field-user-picture img { float: right; margin-left: 20px; margin-right: 0; } -.field-name-field-tags { +.field--name-field-tags { margin: 0 0 1.2em; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } -.field-name-field-tags .field-label { +.field--name-field-tags .field__label { font-weight: normal; margin: 0; padding-right: 5px; /* LTR */ } -[dir="rtl"] .field-name-field-tags .field-label { +[dir="rtl"] .field--name-field-tags .field__label { padding-left: 5px; padding-right: 0; } -.field-name-field-tags .field-label, -.field-name-field-tags ul.links { +.field--name-field-tags .field__label, +.field--name-field-tags ul.links { font-size: 0.8em; } -.node--view-mode-teaser .field-name-field-tags .field-label, -.node--view-mode-teaser .field-name-field-tags ul.links { +.node--view-mode-teaser .field--name-field-tags .field__label, +.node--view-mode-teaser .field--name-field-tags ul.links { font-size: 0.821em; } -.field-name-field-tags ul.links { +.field--name-field-tags ul.links { padding: 0; margin: 0; list-style: none; } -.field-name-field-tags ul.links li { +.field--name-field-tags ul.links li { float: left; /* LTR */ padding: 0 1em 0 0; /* LTR */ white-space: nowrap; } -[dir="rtl"] .field-name-field-tags ul.links li { +[dir="rtl"] .field--name-field-tags ul.links li { padding: 0 0 0 1em; float: right; } @@ -138,23 +138,23 @@ h1#page-title { text-align: left; } @media all and (min-width: 560px) { - .node .field-type-image { + .node .field--type-image { float: left; /* LTR */ margin: 0 1em 0 0; /* LTR */ } - [dir="rtl"] .node .field-type-image { + [dir="rtl"] .node .field--type-image { float: right; margin: 0 0 0 1em; } - .node .field-type-image + .field-type-image { + .node .field--type-image + .field--type-image { clear: both; } } -.field-type-image img, -.field-name-field-user-picture img { +.field--type-image img, +.field--name-field-user-picture img { margin: 0 0 1em; } -.field-type-image a { +.field--type-image a { border-bottom: none; } ul.links { diff --git a/core/themes/bartik/templates/field--node--field-tags.html.twig b/core/themes/bartik/templates/field--node--field-tags.html.twig index c228697..dab4094 100644 --- a/core/themes/bartik/templates/field--node--field-tags.html.twig +++ b/core/themes/bartik/templates/field--node--field-tags.html.twig @@ -21,20 +21,18 @@ * @see bartik_preprocess_field() */ #} -{% set field_name_class = field_name|clean_class %} {% set classes = [ 'field', - 'field-' ~ entity_type|clean_class ~ '--' ~ field_name_class, - 'field-name-' ~ field_name_class, - 'field-type-' ~ field_type|clean_class, - 'field-label-' ~ label_display, + 'field--name-' ~ field_name|clean_class, + 'field--type-' ~ field_type|clean_class, + 'field--label-' ~ label_display, 'clearfix', ] %} {% set title_classes = [ - 'field-label', + 'field__label', label_display == 'inline' ? 'inline', ] %} @@ -42,7 +40,7 @@ {% if not label_hidden %} {{ label }} {% endif %} - +