public static function MenuSelectTree::validateMenuSelectTree in Menu Select 8
Same name and namespace in other branches
- 2.0.x src/Element/MenuSelectTree.php \Drupal\menu_select\Element\MenuSelectTree::validateMenuSelectTree()
Validate the element.
Setting the form state value, in addition to ::valueCallback is required for this element to return a single string, instead of an array.
File
- src/
Element/ MenuSelectTree.php, line 116
Class
- MenuSelectTree
- A form element for the select tree.
Namespace
Drupal\menu_select\ElementCode
public static function validateMenuSelectTree(&$element, FormStateInterface $form_state, &$complete_form) {
$input_exists = FALSE;
$input = NestedArray::getValue($form_state
->getValues(), $element['#parents'], $input_exists);
if ($input_exists) {
$form_state
->setValueForElement($element, $input['tree']['menu_parent_id']);
}
}