diff --git a/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php b/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php index 2579dcbf9e05e9d64ca7c5c1f59e79c96003d460..b77acedf7ff27a3a7fc0b658d5621a63afa4a2dc 100644 --- a/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php +++ b/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php @@ -138,7 +138,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin $values['title'] = mt_rand(0, 1) ? $random->sentences(4) : ''; break; } - $values['uri'] = 'http://www.' . $random->word($domain_length) . '.' . $tlds[mt_rand(0, (count($tlds) - 1))]; + $values['uri'] = 'https://www.' . $random->word($domain_length) . '.' . $tlds[mt_rand(0, (count($tlds) - 1))]; } else { $values['uri'] = 'base:' . $random->name(mt_rand(1, 64)); diff --git a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php index 80c5704f343b02682d3a46ab272643d4979f73ce..b596be82f73c7c889693876bc13edf7057fc4de7 100644 --- a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php +++ b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php @@ -234,12 +234,12 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen // If the field is configured to allow both internal and external links, // show a useful description. elseif ($this->supportsExternalLinks() && $this->supportsInternalLinks()) { - $element['uri']['#description'] = $this->t('Start typing the title of a piece of content to select it. You can also enter an internal path such as %add-node or an external URL such as %url. Enter %front to link to the front page. Enter %nolink to display link text only. Enter %button to display keyboard-accessible link text only.', ['%front' => '<front>', '%add-node' => '/node/add', '%url' => 'http://example.com', '%nolink' => '<nolink>', '%button' => '<button>']); + $element['uri']['#description'] = $this->t('Start typing the title of a piece of content to select it. You can also enter an internal path such as %add-node or an external URL such as %url. Enter %front to link to the front page. Enter %nolink to display link text only. Enter %button to display keyboard-accessible link text only.', ['%front' => '<front>', '%add-node' => '/node/add', '%url' => 'https://example.com', '%nolink' => '<nolink>', '%button' => '<button>']); } // If the field is configured to allow only external links, show a useful // description. elseif ($this->supportsExternalLinks() && !$this->supportsInternalLinks()) { - $element['uri']['#description'] = $this->t('This must be an external URL such as %url.', ['%url' => 'http://example.com']); + $element['uri']['#description'] = $this->t('This must be an external URL such as %url.', ['%url' => 'https://example.com']); } // Make uri required on the front-end when title filled-in. diff --git a/core/modules/link/tests/src/Functional/LinkFieldUITest.php b/core/modules/link/tests/src/Functional/LinkFieldUITest.php index dd4fe7370a0bbf53c5bd7688e87c4736d5e43b84..ac8d37f5b2fe8c1e6732157fc4e0c363d82e0968 100644 --- a/core/modules/link/tests/src/Functional/LinkFieldUITest.php +++ b/core/modules/link/tests/src/Functional/LinkFieldUITest.php @@ -96,7 +96,7 @@ protected function providerTestFieldUI() { DRUPAL_OPTIONAL, ]; $link_types = [ - LinkItemInterface::LINK_EXTERNAL => 'http://example.com', + LinkItemInterface::LINK_EXTERNAL => 'https://example.com', LinkItemInterface::LINK_GENERIC => '', LinkItemInterface::LINK_INTERNAL => '<front>', ]; @@ -119,7 +119,7 @@ protected function providerTestFieldUI() { ]); // Use a unique label that contains some HTML. - $label = '<img src="http://example.com">' . $id; + $label = '<img src="https://example.com">' . $id; yield [ $cardinality, @@ -191,8 +191,8 @@ public function runFieldUIItem($cardinality, $link_type, $title, $label, $field_ $this->drupalGet($add_path); $expected_help_texts = [ - LinkItemInterface::LINK_EXTERNAL => 'This must be an external URL such as <em class="placeholder">http://example.com</em>.', - LinkItemInterface::LINK_GENERIC => 'You can also enter an internal path such as <em class="placeholder">/node/add</em> or an external URL such as <em class="placeholder">http://example.com</em>. Enter <em class="placeholder"><front></em> to link to the front page. Enter <em class="placeholder"><nolink></em> to display link text only', + LinkItemInterface::LINK_EXTERNAL => 'This must be an external URL such as <em class="placeholder">https://example.com</em>.', + LinkItemInterface::LINK_GENERIC => 'You can also enter an internal path such as <em class="placeholder">/node/add</em> or an external URL such as <em class="placeholder">https://example.com</em>. Enter <em class="placeholder"><front></em> to link to the front page. Enter <em class="placeholder"><nolink></em> to display link text only', LinkItemInterface::LINK_INTERNAL => rtrim(Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString(), '/'), ];