You are here

protected function AdminForm::setParentOnElements in Webform CiviCRM Integration 8.5

Set parents for all elements in the webform.

1 call to AdminForm::setParentOnElements()
AdminForm::postProcess in src/AdminForm.php
Submission handler, saves CiviCRM options for a Webform node

File

src/AdminForm.php, line 2076
Webform CiviCRM module's admin form.

Class

AdminForm
@file Webform CiviCRM module's admin form.

Namespace

Drupal\webform_civicrm

Code

protected function setParentOnElements(&$enabled) {
  if (!isset($enabled['contact_pagebreak'])) {
    $enabled = array_merge([
      'contact_pagebreak' => [
        'type' => 'webform_wizard_page',
        'form_key' => 'contact_pagebreak',
        'title' => (string) t('Contact Information'),
      ],
    ], $enabled);
  }
  foreach ($enabled as $key => &$element) {
    if (!is_array($element) || isset($element['parent']) || strpos($key, 'pagebreak') !== FALSE) {
      continue;
    }
    $element['parent'] = strpos($key, '_contribution_') !== FALSE ? 'contribution_pagebreak' : 'contact_pagebreak';
  }
}