function TextItemBase::validateAllowedFormats
Same name and namespace in other branches
- 10 core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php \Drupal\text\Plugin\Field\FieldType\TextItemBase::validateAllowedFormats()
Render API callback: Processes the allowed formats value.
Ensure the element's value is an indexed array of selected format IDs. This function is assigned as an #element_validate callback.
See also
File
-
core/
modules/ text/ src/ Plugin/ Field/ FieldType/ TextItemBase.php, line 51
Class
- TextItemBase
- Base class for 'text' configurable field types.
Namespace
Drupal\text\Plugin\Field\FieldTypeCode
public static function validateAllowedFormats(array &$element, FormStateInterface $form_state) {
$value = array_values(array_filter($form_state->getValue($element['#parents'])));
$form_state->setValueForElement($element, $value);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.