degov-8.x-2.0/modules/degov_rich_text_format_settings/degov_rich_text_format_settings.module
modules/degov_rich_text_format_settings/degov_rich_text_format_settings.module
<?php
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_form_FORM_ID_alter().
*/
function degov_rich_text_format_settings_form_entity_embed_dialog_alter(&$form, FormStateInterface $form_state, $form_id) {
// Add autocompletion to the link url field of the entity embed dialog. This
// requires the patch added to this module's composer.json and the Linkit
// module, which is a dependency of this module.
if (isset($form['attributes']['data-entity-embed-display-settings']['link_url'])) {
$form['attributes']['data-entity-embed-display-settings']['link_url']['#type'] = 'linkit';
$form['attributes']['data-entity-embed-display-settings']['link_url']['#autocomplete_route_name'] = 'linkit.autocomplete';
$form['attributes']['data-entity-embed-display-settings']['link_url']['#autocomplete_route_parameters'] = [
'linkit_profile_id' => 'full_text',
];
}
}
