diff --git a/composer.json b/composer.json index eabb4cc33b822642094d7d25e66111750f5b7efe..1d2cd4615794b8c7bbdb95e894a1e29b9c901c50 100644 --- a/composer.json +++ b/composer.json @@ -131,7 +131,7 @@ "drupal/image_popup": "1.1", "drupal/inline_entity_form": "1.0-rc7", "drupal/libraries": "3.0.0-alpha1", - "drupal/link_attributes": "1.10", + "drupal/link_attributes": "1.11", "drupal/linkit": "5.0-beta11", "drupal/magnific_popup": "1.3", "drupal/mathjax": "2.7", diff --git a/composer.lock b/composer.lock index abfeef19f41544d91cf75d92709ebaa51fba3827..8310cacc32fc36c7a9aded84f909844ef31583f3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8bbf1b75a83436fa7654bf0208a40f2d", + "content-hash": "31bc539ebf7d9723cb8e89d000701658", "packages": [ { "name": "alchemy/zippy", @@ -5457,29 +5457,26 @@ }, { "name": "drupal/link_attributes", - "version": "1.10.0", + "version": "1.11.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/link_attributes.git", - "reference": "8.x-1.10" + "reference": "8.x-1.11" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/link_attributes-8.x-1.10.zip", - "reference": "8.x-1.10", - "shasum": "3df450b83a05911575aaf9b234a3b43833d3c1c2" + "url": "https://ftp.drupal.org/files/projects/link_attributes-8.x-1.11.zip", + "reference": "8.x-1.11", + "shasum": "ca8c7e71c38350e3784dc3d1f779d700f55df818" }, "require": { "drupal/core": "^8 || ^9" }, "type": "drupal-module", "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, "drupal": { - "version": "8.x-1.10", - "datestamp": "1580259496", + "version": "8.x-1.11", + "datestamp": "1598323550", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index cce0268e72f5cecd7be1a9e5c7dfa35954c725f6..9e6589ab5ace2f776793b56d58f07ceaf7a4729b 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -5621,30 +5621,27 @@ }, { "name": "drupal/link_attributes", - "version": "1.10.0", - "version_normalized": "1.10.0.0", + "version": "1.11.0", + "version_normalized": "1.11.0.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/link_attributes.git", - "reference": "8.x-1.10" + "reference": "8.x-1.11" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/link_attributes-8.x-1.10.zip", - "reference": "8.x-1.10", - "shasum": "3df450b83a05911575aaf9b234a3b43833d3c1c2" + "url": "https://ftp.drupal.org/files/projects/link_attributes-8.x-1.11.zip", + "reference": "8.x-1.11", + "shasum": "ca8c7e71c38350e3784dc3d1f779d700f55df818" }, "require": { "drupal/core": "^8 || ^9" }, "type": "drupal-module", "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, "drupal": { - "version": "8.x-1.10", - "datestamp": "1580259496", + "version": "8.x-1.11", + "datestamp": "1598323550", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" diff --git a/web/modules/link_attributes/link_attributes.info.yml b/web/modules/link_attributes/link_attributes.info.yml index 4609f004dd3eb629a7ef740cab2e70381f22ff29..9e127f3271a3185cdb0999773a6526c5e5e77a6e 100644 --- a/web/modules/link_attributes/link_attributes.info.yml +++ b/web/modules/link_attributes/link_attributes.info.yml @@ -7,7 +7,7 @@ dependencies: - drupal:link - drupal:system (>=8.4) -# Information added by Drupal.org packaging script on 2020-01-29 -version: '8.x-1.10' +# Information added by Drupal.org packaging script on 2020-08-25 +version: '8.x-1.11' project: 'link_attributes' -datestamp: 1580259499 +datestamp: 1598323551 diff --git a/web/modules/link_attributes/src/Plugin/Field/FieldWidget/LinkWithAttributesWidget.php b/web/modules/link_attributes/src/Plugin/Field/FieldWidget/LinkWithAttributesWidget.php index e298e3d4b7c11c3299d930b146dfd04da0b18c6b..5f69353d1248b872c1caba1e65565f1712a0ba94 100644 --- a/web/modules/link_attributes/src/Plugin/Field/FieldWidget/LinkWithAttributesWidget.php +++ b/web/modules/link_attributes/src/Plugin/Field/FieldWidget/LinkWithAttributesWidget.php @@ -88,8 +88,6 @@ public static function defaultSettings() { */ public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $element = parent::formElement($items, $delta, $element, $form, $form_state); - // Add each of the enabled attributes. - // @todo move this to plugins that nominate form and label. $item = $items[$delta]; $options = $item->get('options')->getValue(); @@ -104,6 +102,10 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen foreach (array_keys(array_filter($this->getSetting('enabled_attributes'))) as $attribute) { if (isset($plugin_definitions[$attribute])) { foreach ($plugin_definitions[$attribute] as $property => $value) { + if ($property === 'id') { + // Don't set ID. + continue; + } $element['options']['attributes'][$attribute]['#' . $property] = $value; } diff --git a/web/modules/link_attributes/tests/modules/link_attributes_test_alterinfo/link_attributes_test_alterinfo.info.yml b/web/modules/link_attributes/tests/modules/link_attributes_test_alterinfo/link_attributes_test_alterinfo.info.yml index a449282d9f69e82229349b396f5fc5e78b891c8d..704c70e956f72fee6aeba99ab05b0ce4aa3c35cb 100644 --- a/web/modules/link_attributes/tests/modules/link_attributes_test_alterinfo/link_attributes_test_alterinfo.info.yml +++ b/web/modules/link_attributes/tests/modules/link_attributes_test_alterinfo/link_attributes_test_alterinfo.info.yml @@ -6,7 +6,7 @@ core_version_requirement: ^8 || ^9 dependencies: - link_attributes:link_attributes -# Information added by Drupal.org packaging script on 2020-01-29 -version: '8.x-1.10' +# Information added by Drupal.org packaging script on 2020-08-25 +version: '8.x-1.11' project: 'link_attributes' -datestamp: 1580259499 +datestamp: 1598323551 diff --git a/web/modules/link_attributes/tests/src/Functional/LinkAttributesFieldTest.php b/web/modules/link_attributes/tests/src/Functional/LinkAttributesFieldTest.php index 1a9301f8a4f709d3e231bd123727b309c07f72fe..d2d7ca35f87db7cf86033af3c7b5559434699ce1 100644 --- a/web/modules/link_attributes/tests/src/Functional/LinkAttributesFieldTest.php +++ b/web/modules/link_attributes/tests/src/Functional/LinkAttributesFieldTest.php @@ -103,8 +103,9 @@ public function testWidget() { // Target attribute. $attribute_target = 'field_' . $field_name . '[0][options][attributes][target]'; - $web_assert->fieldExists($attribute_target); + $target = $web_assert->fieldExists($attribute_target); $web_assert->fieldValueEquals($attribute_target, '_blank'); + $this->assertNotEquals('target', $target->getAttribute('id')); \Drupal::state()->set('link_attributes_test_alterinfo.hook_link_attributes_plugin_alter', FALSE); \Drupal::service('plugin.manager.link_attributes')->clearCachedDefinitions(); @@ -118,7 +119,7 @@ public function testWidget() { 'field_' . $field_name . '[1][uri]' => '<front>', 'field_' . $field_name . '[1][options][attributes][class]' => 'class-three class-four', ]; - $this->drupalPostForm($add_path, $edit, t('Save')); + $this->drupalPostForm($add_path, $edit, 'Save'); $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); // Load the field values. @@ -176,7 +177,7 @@ public function testWidgetWithoutAttributes() { 'field_' . $field_name . '[0][title]' => 'Link One', 'field_' . $field_name . '[0][uri]' => '<front>', ]; - $this->drupalPostForm($add_path, $edit, t('Save')); + $this->drupalPostForm($add_path, $edit, 'Save'); $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); $this->drupalGet($node->toUrl()->toString()); $web_assert->linkExists('Link One'); diff --git a/web/modules/link_attributes/tests/src/Functional/LinkAttributesMenuTest.php b/web/modules/link_attributes/tests/src/Functional/LinkAttributesMenuTest.php index 1f5b599ad916f9dae53e2ae4da45cd08e9876020..4c2bf361b689de3e0c2038516e441ee2ba38530a 100644 --- a/web/modules/link_attributes/tests/src/Functional/LinkAttributesMenuTest.php +++ b/web/modules/link_attributes/tests/src/Functional/LinkAttributesMenuTest.php @@ -52,7 +52,7 @@ public function testMenuLinkAdmin() { // This is enough to check the fields are there. 'link[0][options][attributes][target]' => '_blank', 'link[0][options][attributes][class]' => 'menu__link--really_special menu__link--another-class', - ], t('Save')); + ], 'Save'); $this->drupalGet('user'); $page = $this->getSession()->getPage(); // The link should exist and contain the required attributes. @@ -88,7 +88,7 @@ public function testMenuLinkAdmin() { 'link[0][uri]' => '<front>', 'link[0][options][attributes][target]' => '', 'link[0][options][attributes][rel]' => 'author', - ], t('Save')); + ], 'Save'); $this->drupalGet('user'); $page = $this->getSession()->getPage(); // The link should exist and contain the set rel attribute. diff --git a/web/modules/link_attributes/tests/src/Kernel/InfoAlterTest.php b/web/modules/link_attributes/tests/src/Kernel/InfoAlterTest.php index f49bd9e0ab104494c69c256ff40659b502afd19e..eadea4028d4fe7379f01804fb792a737ba1f359b 100644 --- a/web/modules/link_attributes/tests/src/Kernel/InfoAlterTest.php +++ b/web/modules/link_attributes/tests/src/Kernel/InfoAlterTest.php @@ -38,7 +38,7 @@ public function testLinkAttributesManagerInfoAlter() { $linkAttributesManager->clearCachedDefinitions(); $definition = $linkAttributesManager->getDefinitions(); $this->assertTrue($definition['class']['type'] == 'select', 'After altering the plugin definition the class attribute is a select.'); - $this->assertTrue(isset($definition['class']['options']['button']), 'After altering the plugin definition the class attribute has a "button" option.'); + $this->assertArrayHasKey('button', $definition['class']['options']); } }