protected static function Form::addFirstPagebreak in Form Builder 7.2
1 call to Form::addFirstPagebreak()
- Form::loadFromStorage in modules/
webform/ src/ Form.php
File
- modules/
webform/ src/ Form.php, line 24
Class
Namespace
Drupal\form_builder_webformCode
protected static function addFirstPagebreak($node, $components) {
// Only do this if using webform4 or webform_steps_w3.
if (array_key_exists('progressbar_label_first', $node->webform)) {
$first = reset($components);
if ($first['type'] != 'pagebreak') {
$form_keys = array();
foreach ($components as $c) {
if ($c['pid'] === 0) {
$form_keys[$c['form_key']] = TRUE;
}
}
$form_key = self::LABEL_PREFIX;
$i = 0;
while (!empty($form_keys[$form_key])) {
$form_key = self::LABEL_PREFIX . ++$i;
}
$element = _form_builder_webform_default('pagebreak', array(), array(
'name' => $node->webform['progressbar_label_first'],
'form_key' => $form_key,
'weight' => -100,
));
$components = array(
$element['#webform_component'],
) + $components;
}
}
return $components;
}