You are here

public function SettingBase::getGroupElement in Express 8

Retrieves the group form element the setting belongs to.

Parameters

\Drupal\bootstrap\Utility\Element $form: The Element object that comprises the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

\Drupal\bootstrap\Utility\Element The group element object.

Overrides SettingInterface::getGroupElement

10 calls to SettingBase::getGroupElement()
CdnProvider::alterFormElement in themes/contrib/bootstrap/src/Plugin/Setting/Advanced/Cdn/CdnProvider.php
The alter method to store the code.
ModalAnimation::alterFormElement in themes/contrib/bootstrap/src/Plugin/Setting/JavaScript/Modals/ModalAnimation.php
The alter method to store the code.
ModalEnabled::alterFormElement in themes/contrib/bootstrap/src/Plugin/Setting/JavaScript/Modals/ModalEnabled.php
The alter method to store the code.
PopoverAnimation::alterFormElement in themes/contrib/bootstrap/src/Plugin/Setting/JavaScript/Popovers/PopoverAnimation.php
The alter method to store the code.
PopoverEnabled::alterFormElement in themes/contrib/bootstrap/src/Plugin/Setting/JavaScript/Popovers/PopoverEnabled.php
The alter method to store the code.

... See full list

File

themes/contrib/bootstrap/src/Plugin/Setting/SettingBase.php, line 87
Contains \Drupal\bootstrap\Plugin\Setting\SettingBase.

Class

SettingBase
Base class for a setting.

Namespace

Drupal\bootstrap\Plugin\Setting

Code

public function getGroupElement(Element $form, FormStateInterface $form_state) {
  $groups = $this
    ->getGroups();
  $group = $form;
  $first = TRUE;
  foreach ($groups as $key => $title) {
    if (!isset($group->{$key})) {
      if ($title) {
        $group->{$key} = [
          '#type' => 'details',
          '#title' => $title,
        ];
      }
      else {
        $group->{$key} = [
          '#type' => 'container',
        ];
      }
      $group = Element::create($group->{$key}
        ->getArray());
      if ($first) {
        $group
          ->setProperty('group', 'bootstrap');
      }
      else {
        $group
          ->setProperty('open', FALSE);
      }
    }
    else {
      $group = Element::create($group->{$key}
        ->getArray());
    }
    $first = FALSE;
  }
  return $group;
}