public function BricksTreeDynamicWidget::formElement in Bricks 2.x
Same name and namespace in other branches
- 8 modules/bricks_dynamic/src/Plugin/Field/FieldWidget/BricksTreeDynamicWidget.php \Drupal\bricks_dynamic\Plugin\Field\FieldWidget\BricksTreeDynamicWidget::formElement()
File
- modules/
bricks_dynamic/ src/ Plugin/ Field/ FieldWidget/ BricksTreeDynamicWidget.php, line 26
Class
- BricksTreeDynamicWidget
- Plugin annotation @FieldWidget( id = "bricks_tree_dynamic", label = @Translation("Bricks tree (Dynamic)"), description = @Translation("A tree of autocomplete text fields."), field_types = { "bricks_dynamic" } )
Namespace
Drupal\bricks_dynamic\Plugin\Field\FieldWidgetCode
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element = parent::formElement($items, $delta, $element, $form, $form_state);
// #default_value is en Entity or NULL.
_bricks_form_element_alter($element, $items[$delta], $element['target_id']['#default_value']);
hide($element['depth']);
return $element;
}