diff --git a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php index bd67402..d33282d 100644 --- a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php +++ b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php @@ -149,8 +149,9 @@ public function viewElements(FieldItemListInterface $items) { ); if (!empty($item->_attributes)) { - // Take the fallback behavior of ___ by just setting the - // _attributes directly. + // Piggyback on the metadata attributes, + // which will be placed in the field template wrapper, + // and set the URL value in a content attribute. $item->_attributes += array('content' => $item->url); } } @@ -160,7 +161,6 @@ public function viewElements(FieldItemListInterface $items) { '#title' => $link_title, '#options' => $url->getOptions(), ); - if ($url->isExternal()) { $element[$delta]['#href'] = $url->getPath(); } diff --git a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkSeparateFormatter.php b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkSeparateFormatter.php index b0e7a16..40daa44 100644 --- a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkSeparateFormatter.php +++ b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkSeparateFormatter.php @@ -79,6 +79,7 @@ public function viewElements(FieldItemListInterface $items) { ); if (!empty($item->_attributes)) { + // Set our RDFa attributes on the element that is being built. $url->setOption('attributes', $item->_attributes); // Unset field item attributes since they have been included in the diff --git a/core/modules/rdf/src/Tests/Field/EmailFieldRdfaTest.php b/core/modules/rdf/src/Tests/Field/EmailFieldRdfaTest.php index 273aa94..7eb8d33 100644 --- a/core/modules/rdf/src/Tests/Field/EmailFieldRdfaTest.php +++ b/core/modules/rdf/src/Tests/Field/EmailFieldRdfaTest.php @@ -48,7 +48,6 @@ public function setUp() { public function testAllFormatters() { // Test the plain formatter. $this->assertFormatterRdfa(array('type'=>'string'), 'http://schema.org/email', array('value' => $this->testValue)); - // Test the mailto formatter. $this->assertFormatterRdfa(array('type'=>'email_mailto'), 'http://schema.org/email', array('value' => $this->testValue)); }