comparison core/modules/field/field.api.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
40 * @see field 40 * @see field
41 * @see field_widget 41 * @see field_widget
42 * @see field_formatter 42 * @see field_formatter
43 * @see plugin_api 43 * @see plugin_api
44 */ 44 */
45
46 45
47 /** 46 /**
48 * Perform alterations on Field API field types. 47 * Perform alterations on Field API field types.
49 * 48 *
50 * @param $info 49 * @param $info
291 */ 290 */
292 function hook_field_widget_multivalue_WIDGET_TYPE_form_alter(array &$elements, \Drupal\Core\Form\FormStateInterface $form_state, array $context) { 291 function hook_field_widget_multivalue_WIDGET_TYPE_form_alter(array &$elements, \Drupal\Core\Form\FormStateInterface $form_state, array $context) {
293 // Code here will only act on widgets of type WIDGET_TYPE. For example, 292 // Code here will only act on widgets of type WIDGET_TYPE. For example,
294 // hook_field_widget_multivalue_mymodule_autocomplete_form_alter() will only 293 // hook_field_widget_multivalue_mymodule_autocomplete_form_alter() will only
295 // act on widgets of type 'mymodule_autocomplete'. 294 // act on widgets of type 'mymodule_autocomplete'.
296 // Change the autcomplete route for each autocomplete element within the 295 // Change the autocomplete route for each autocomplete element within the
297 // multivalue widget. 296 // multivalue widget.
298 foreach (Element::children($elements) as $delta => $element) { 297 foreach (Element::children($elements) as $delta => $element) {
299 $elements[$delta]['#autocomplete_route_name'] = 'mymodule.autocomplete_route'; 298 $elements[$delta]['#autocomplete_route_name'] = 'mymodule.autocomplete_route';
300 } 299 }
301 } 300 }