You are here

protected function FieldGroupFormatterBase::getClasses in Field Group 8

Same name and namespace in other branches
  1. 8.3 src/FieldGroupFormatterBase.php \Drupal\field_group\FieldGroupFormatterBase::getClasses()

Get the classes to add to the group.

7 calls to FieldGroupFormatterBase::getClasses()
Accordion::preRender in src/Plugin/field_group/FieldGroupFormatter/Accordion.php
Allows the field group formatter to manipulate the field group array and attach the formatters rendering element.
AccordionItem::preRender in src/Plugin/field_group/FieldGroupFormatter/AccordionItem.php
Allows the field group formatter to manipulate the field group array and attach the formatters rendering element.
Details::preRender in src/Plugin/field_group/FieldGroupFormatter/Details.php
Allows the field group formatter to manipulate the field group array and attach the formatters rendering element.
Fieldset::preRender in src/Plugin/field_group/FieldGroupFormatter/Fieldset.php
Allows the field group formatter to manipulate the field group array and attach the formatters rendering element.
HtmlElement::preRender in src/Plugin/field_group/FieldGroupFormatter/HtmlElement.php
Allows the field group formatter to manipulate the field group array and attach the formatters rendering element.

... See full list

1 method overrides FieldGroupFormatterBase::getClasses()
Tabs::getClasses in src/Plugin/field_group/FieldGroupFormatter/Tabs.php
Get the classes to add to the group.

File

src/FieldGroupFormatterBase.php, line 154

Class

FieldGroupFormatterBase
Base class for 'Fieldgroup formatter' plugin implementations.

Namespace

Drupal\field_group

Code

protected function getClasses() {
  $classes = array();

  // Add a required-fields class to trigger the js.
  if ($this
    ->getSetting('required_fields')) {
    $classes[] = 'required-fields';
    $classes[] = 'field-group-' . str_replace('_', '-', $this
      ->getBaseId());
  }
  if ($this
    ->getSetting('classes')) {
    $classes = array_merge($classes, explode(' ', trim($this
      ->getSetting('classes'))));
  }
  return $classes;
}