protected static function MediaForm::setFieldState in GridStack 8.2
Sets the field state for the widget.
2 calls to MediaForm::setFieldState()
- MediaForm::addItems in src/
Plugin/ gridstack/ stylizer/ MediaForm.php - Updates the field state and flags the form for rebuild.
- MediaForm::removeItem in src/
Plugin/ gridstack/ stylizer/ MediaForm.php - Submit callback for remove buttons.
File
- src/
Plugin/ gridstack/ stylizer/ MediaForm.php, line 659
Class
- MediaForm
- Provides the media form for Layout Builder integration.
Namespace
Drupal\gridstack\Plugin\gridstack\stylizerCode
protected static function setFieldState(array $element, FormStateInterface $form_state, array $field_state) {
// @todo the field_parents is just to sattisfy MediaLibraryWidget.
// @todo $element.layout_settings.settings.styles['#field_name'|'select']
$element['#field_parents'] = isset($element['#parents']) ? $element['#parents'] : [];
MediaLibraryWidget::setWidgetState($element['#field_parents'], $element['#field_name'], $form_state, $field_state);
}