$element['uri'
]['#target_type'
] = 'node';
// Disable autocompletion when the first character is '/', '#' or '?'.
$element['uri'
]['#attributes'
]['data-autocomplete-first-character-blacklist'
] = '/#?';
// The link widget is doing its own processing in
// static::getUriAsDisplayableString().
$element['uri'
]['#process_default_value'
] = FALSE;
} // If the field is configured to allow only internal links, add a useful
// element prefix and description.
if (!
$this->
supportsExternalLinks()) { $element['uri'
]['#field_prefix'
] =
rtrim(Url::
fromRoute('<front>',
[],
['absolute' => TRUE
])->
toString(), '/'
);
$element['uri'
]['#description'
] =
$this->
t('This must be an internal path such as %add-node. You can also start typing the title of a piece of content to select it. Enter %front to link to the front page. Enter %nolink to display link text only. Enter %button to display keyboard-accessible link text only.',
['%add-node' => '/node/add', '%front' => '<front>', '%nolink' => '<nolink>', '%button' => '<button>'
]);
} // 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>'
]);
} // If the field is configured to allow only external links, show a useful
// description.
elseif ($this->
supportsExternalLinks() && !
$this->
supportsInternalLinks()) {