public static function GranularityElement::validateElement in Duration Field 3.0.x
Same name and namespace in other branches
- 8.2 src/Element/GranularityElement.php \Drupal\duration_field\Element\GranularityElement::validateElement()
Converts the submitted values array to a granularity string, and sets the string as the value of the form element. All handlers after this point will receive the string as the value for the form element.
File
- src/
Element/ GranularityElement.php, line 149
Class
- GranularityElement
- Provides the Granularity form element.
Namespace
Drupal\duration_field\ElementCode
public static function validateElement(&$element, FormStateInterface $form_state, $form) {
$form_state
->setValueForElement($element, \Drupal::service('duration_field.granularity.service')
->convertGranularityArrayToGranularityString($form_state
->getValue($element['#parents'])));
}