public static function Dazzler::traverse in Formdazzle! 2.x
A recursive helper function to traverse all form element children.
Parameters
array $element: The form or form element to recurse.
string $form_id: The ID of the form the element belongs to.
string $form_id_suggestion: A suggestion to use based on the form ID.
2 calls to Dazzler::traverse()
- Dazzler::preRenderForm in src/
Dazzler.php - Adds template suggestions to forms.
- DazzlerTest::testTraverse in tests/
src/ Unit/ DazzlerTest.php - @covers ::traverse
File
- src/
Dazzler.php, line 168
Class
- Dazzler
- A class providing methods to modify Drupal form elements.
Namespace
Drupal\formdazzleCode
public static function traverse(array &$element, $form_id, $form_id_suggestion) {
// Add the default info for the #type of form element.
self::addDefaultThemeProperties($element);
// Add template suggestions to form element.
self::addSuggestions($element, $form_id, $form_id_suggestion);
// Traverse all the element's children.
foreach (Element::children($element) as $element_name) {
self::traverse($element[$element_name], $form_id, $form_id_suggestion);
}
}