function chosen_field_widget_form_alter in Chosen 3.0.x
Same name and namespace in other branches
- 8.2 chosen.module \chosen_field_widget_form_alter()
- 6 chosen.module \chosen_field_widget_form_alter()
- 7.3 chosen.module \chosen_field_widget_form_alter()
- 7 chosen.module \chosen_field_widget_form_alter()
- 7.2 chosen.module \chosen_field_widget_form_alter()
Implements hook_field_widget_form_alter().
File
- ./
chosen.module, line 53 - General functions and hook implementations.
Code
function chosen_field_widget_form_alter(&$element, FormStateInterface $form_state, $context) {
/** @var \Drupal\Core\Field\FieldDefinitionInterface $field_definition */
$field_definition = $context['items']
->getFieldDefinition();
$element['#entity_type'] = $field_definition
->getTargetEntityTypeId();
$element['#bundle'] = $field_definition
->getTargetBundle();
}