public static function ExifFieldWidgetBase::validateExifFieldSeparator in Exif 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldWidget/ExifFieldWidgetBase.php \Drupal\exif\Plugin\Field\FieldWidget\ExifFieldWidgetBase::validateExifFieldSeparator()
Ensure field separator is correctly configured.
Parameters
array $element: A form element array containing basic properties for the widget.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- src/
Plugin/ Field/ FieldWidget/ ExifFieldWidgetBase.php, line 53
Class
- ExifFieldWidgetBase
- Class ExifFieldWidgetBase provide base methods for all widgets.
Namespace
Drupal\exif\Plugin\Field\FieldWidgetCode
public static function validateExifFieldSeparator(array $element, FormStateInterface &$form_state) {
$elementSettings = $form_state
->getValue($element['#parents']);
if (!empty($elementSettings) && strlen($elementSettings) > 1) {
$message = t('the separator is only one character long.');
$form_state
->setErrorByName('exif_field_separator', $message);
}
}