public function BricksTreeInlineWidget::formElement in Bricks 2.x
Same name and namespace in other branches
- 8 modules/bricks_inline/src/Plugin/Field/FieldWidget/BricksTreeInlineWidget.php \Drupal\bricks_inline\Plugin\Field\FieldWidget\BricksTreeInlineWidget::formElement()
File
- modules/
bricks_inline/ src/ Plugin/ Field/ FieldWidget/ BricksTreeInlineWidget.php, line 41
Class
- BricksTreeInlineWidget
- Plugin annotation @FieldWidget( id = "bricks_tree_inline", label = @Translation("Bricks tree (Inline entity form)"), description = @Translation("A tree of inline entity forms."), field_types = { "bricks", "bricks_revisioned" }, …
Namespace
Drupal\bricks_inline\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);
$element['entities']['#widget'] = 'bricks_tree_inline';
$entities = $form_state
->get([
'inline_entity_form',
$this
->getIefId(),
'entities',
]);
foreach ($entities as $delta => $value) {
_bricks_form_element_alter($element['entities'][$delta], $items[$delta], $value['entity']);
}
return $element;
}