diff --git a/core/includes/form.inc b/core/includes/form.inc index 77443ad..7cfd776 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -4071,17 +4071,13 @@ function theme_vertical_tabs($variables) { } /** - * Adds autocomplete functionality to elements with a valid #autocomplete_path. + * Adds autocomplete functionality to elements with a valid + * #autocomplete_route_name. * - * Suppose your autocomplete path in the menu system is 'mymodule_autocomplete.' + * Suppose your autocomplete route is 'mymodule.autocomplete.' * In your form you have: * @code - * '#autocomplete_path' => 'mymodule_autocomplete/' . $some_key . '/' . $some_id, - * @endcode - * Or if your route is called 'mymodule_autocomplete' with the path of - * '/mymodule-autocomplete/{a}/{b}': - * @code - * '#autocomplete_route_name' => 'mymodule_autocomplete', + * '#autocomplete_route_name' => 'mymodule.autocomplete', * '#autocomplete_route_parameters' => array('a' => $some_key, 'b' => $some_id), * @endcode * The user types in "keywords" so the full path called is: @@ -4089,8 +4085,6 @@ function theme_vertical_tabs($variables) { * * @param array $element * The form element to process. Properties used: - * - #autocomplete_path: A system path to be used as callback URL by the - * autocomplete JavaScript library. * - #autocomplete_route_name: A route to be used as callback URL by the * autocomplete JavaScript library. * - #autocomplete_route_parameters: The parameters to be used in conjunction @@ -4109,10 +4103,6 @@ function form_process_autocomplete($element, &$form_state) { $path = \Drupal::urlGenerator()->generate($element['#autocomplete_route_name'], $parameters); $access = \Drupal::service('access_manager')->checkNamedRoute($element['#autocomplete_route_name'], $parameters); } - elseif (!empty($element['#autocomplete_path'])) { - $path = url($element['#autocomplete_path'], array('absolute' => TRUE)); - $access = drupal_valid_path($element['#autocomplete_path']); - } if ($access) { $element['#attributes']['class'][] = 'form-autocomplete'; $element['#attached']['library'][] = array('system', 'drupal.autocomplete'); diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php index 161c230..16a9138 100644 --- a/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -238,7 +238,7 @@ function hook_field_widget_WIDGET_TYPE_form_alter(&$element, &$form_state, $cont // Code here will only act on widgets of type WIDGET_TYPE. For example, // hook_field_widget_mymodule_autocomplete_form_alter() will only act on // widgets of type 'mymodule_autocomplete'. - $element['#autocomplete_path'] = 'mymodule/autocomplete_path'; + $element['#autocomplete_route_name'] = 'mymodule.autocomplete_route'; } /** diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 03f9042..84e3a4f 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -325,7 +325,7 @@ function system_element_info() { '#input' => TRUE, '#size' => 60, '#maxlength' => 128, - '#autocomplete_path' => FALSE, + '#autocomplete_route_name' => FALSE, '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'), '#pre_render' => array('form_pre_render_textfield'), '#theme' => 'input__textfield', @@ -335,7 +335,7 @@ function system_element_info() { '#input' => TRUE, '#size' => 30, '#maxlength' => 128, - '#autocomplete_path' => FALSE, + '#autocomplete_route_name' => FALSE, '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'), '#pre_render' => array('form_pre_render_tel'), '#theme' => 'input__tel', @@ -346,7 +346,7 @@ function system_element_info() { '#size' => 60, // user.module is not loaded in case of early bootstrap errors. '#maxlength' => defined('EMAIL_MAX_LENGTH') ? EMAIL_MAX_LENGTH : 255, - '#autocomplete_path' => FALSE, + '#autocomplete_route_name' => FALSE, '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'), '#element_validate' => array('form_validate_email'), '#pre_render' => array('form_pre_render_email'), @@ -357,7 +357,7 @@ function system_element_info() { '#input' => TRUE, '#size' => 60, '#maxlength' => 255, - '#autocomplete_path' => FALSE, + '#autocomplete_route_name' => FALSE, '#process' => array('form_process_autocomplete', 'ajax_process_form', 'form_process_pattern'), '#element_validate' => array('form_validate_url'), '#pre_render' => array('form_pre_render_url'), @@ -368,7 +368,7 @@ function system_element_info() { '#input' => TRUE, '#size' => 60, '#maxlength' => 128, - '#autocomplete_path' => FALSE, + '#autocomplete_route_name' => FALSE, '#process' => array('form_process_autocomplete', 'ajax_process_form'), '#pre_render' => array('form_pre_render_search'), '#theme' => 'input__search', @@ -408,7 +408,7 @@ function system_element_info() { '#required' => TRUE, '#maxlength' => 64, '#size' => 60, - '#autocomplete_path' => FALSE, + '#autocomplete_route_name' => FALSE, '#process' => array('form_process_machine_name', 'form_process_autocomplete', 'ajax_process_form'), '#element_validate' => array('form_validate_machine_name'), '#pre_render' => array('form_pre_render_textfield'), diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/EditDetails.php b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/EditDetails.php index 3c011f3..3a442b7 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/EditDetails.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/Form/Ajax/EditDetails.php @@ -59,7 +59,7 @@ public function buildForm(array $form, array &$form_state) { '#title' => $this->t('View tag'), '#description' => $this->t('Optionally, enter a comma delimited list of tags for this view to use in filtering and sorting views on the administrative page.'), '#default_value' => $view->get('tag'), - '#autocomplete_path' => 'admin/views/ajax/autocomplete/tag', + '#autocomplete_route_name' => 'views_ui.autocomplete', ); $form['details']['description'] = array( '#type' => 'textfield',