diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php index 193a121..4747ed2 100644 --- a/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -291,9 +291,12 @@ public function setOption($name, $value) { } /** - * Returns the path of the URL if it is external. + * Returns the external path of the URL. + * + * Only to be used if self::$external is TRUE. * * @return string + * The external path. */ public function getPath() { return $this->path; @@ -330,7 +333,7 @@ public function toString() { * An associative array containing all the properties of the route. */ public function toArray() { - if ($this->external) { + if ($this->isExternal()) { return array( 'path' => $this->getPath(), 'options' => $this->getOptions(), @@ -352,7 +355,7 @@ public function toArray() { * An associative array suitable for a render array. */ public function toRenderArray() { - if ($this->external) { + if ($this->isExternal()) { return array( '#href' => $this->getPath(), '#options' => $this->getOptions(), diff --git a/core/modules/link/lib/Drupal/link/LinkItemInterface.php b/core/modules/link/lib/Drupal/link/LinkItemInterface.php index 0a1e55d..afe6cb7 100644 --- a/core/modules/link/lib/Drupal/link/LinkItemInterface.php +++ b/core/modules/link/lib/Drupal/link/LinkItemInterface.php @@ -1,6 +1,7 @@ $element['#required'], ); - // If the field is configured to allows internal paths, it cannot use the + // If the field is configured to allow internal paths, it cannot use the // 'url' form element and we have to do the validation ourselves. if ($url_type & LinkItemInterface::LINK_INTERNAL) { $element['url']['#type'] = 'textfield'; diff --git a/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php b/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php index b347a9a..d2b0cc7 100644 --- a/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php +++ b/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php @@ -105,10 +105,10 @@ function testURLValidation() { // Define some valid URLs. $valid_external_entries = array( - 'http://www.example.com/' + 'http://www.example.com/', ); $valid_internal_entries = array( - 'entity_test/add' + 'entity_test/add', ); // Define some invalid URLs. @@ -121,7 +121,7 @@ function testURLValidation() { 'http://', ); $invalid_internal_entries = array( - 'non/existing/path' + 'non/existing/path', ); // Test external and internal URLs for 'url_type' = LinkItemInterface::LINK_GENERIC. @@ -145,7 +145,7 @@ function testURLValidation() { * Asserts that valid URLs can be submitted. * * @param string $field_name - * The field name + * The field name. * @param array $valid_entries * An array of valid URL entries. */ @@ -168,7 +168,7 @@ protected function assertValidEntries($field_name, array $valid_entries) { * Asserts that invalid URLs cannot be submitted. * * @param string $field_name - * The field name + * The field name. * @param array $invalid_entries * An array of invalid URL entries. */