protected function MultiFormBuilder::multiformGetForm in Multiple forms 8
Recursive helper for MultiFormBuilder::getForm().
Parameters
array $element:
array $buttons:
string $form_id:
1 call to MultiFormBuilder::multiformGetForm()
- MultiFormBuilder::getForm in src/MultiFormBuilder.php 
- Gets a renderable form array.
File
- src/MultiFormBuilder.php, line 206 
- Contains \Drupal\multiform\FormBuilder.
Class
Namespace
Drupal\multiformCode
protected function multiformGetForm(&$element, &$buttons, $form_id) {
  foreach (Element::children($element) as $key) {
    $this
      ->multiformGetForm($element[$key], $buttons, $form_id);
  }
  // Save but do not display buttons. Note that this is done before the #name
  // is changed. This way the buttons belong to the top form and their values
  // can be handed to each form.
  if (!empty($element['#is_button'])) {
    $buttons[$element['#value']] = $element;
    $element['#access'] = FALSE;
  }
  elseif (isset($element['#name'])) {
    // If the name was op then we want multiform[$form_id][op]. If it was
    // foo[bar] then we want multiform[$form_id][foo][bar].
    $element['#name'] = "multiform[{$form_id}]" . preg_replace('/^[^[]+/', '[\\0]', $element['#name']);
  }
}