You are here

public function HtmlElement::settingsSummary in Field Group 8.3

Same name and namespace in other branches
  1. 8 src/Plugin/field_group/FieldGroupFormatter/HtmlElement.php \Drupal\field_group\Plugin\field_group\FieldGroupFormatter\HtmlElement::settingsSummary()

Returns a short summary for the current formatter settings.

If an empty result is returned, a UI can still be provided to display a settings form in case the formatter has configurable settings.

Return value

array A short summary of the formatter settings.

Overrides FieldGroupFormatterBase::settingsSummary

File

src/Plugin/field_group/FieldGroupFormatter/HtmlElement.php, line 207

Class

HtmlElement
Plugin implementation of the 'html_element' formatter.

Namespace

Drupal\field_group\Plugin\field_group\FieldGroupFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $summary[] = $this
    ->t('Element: @element', [
    '@element' => $this
      ->getSetting('element'),
  ]);
  if ($this
    ->getSetting('show_label')) {
    $summary[] = $this
      ->t('Label element: @element', [
      '@element' => $this
        ->getSetting('label_element'),
    ]);
    if (!empty($this
      ->getSetting('label_element_classes'))) {
      $summary[] = $this
        ->t('Label element HTML classes: @label_classes', [
        '@label_classes' => $this
          ->getSetting('label_element_classes'),
      ]);
    }
  }
  if ($this
    ->getSetting('attributes')) {
    $summary[] = $this
      ->t('Attributes: @attributes', [
      '@attributes' => $this
        ->getSetting('attributes'),
    ]);
  }
  if ($this
    ->getSetting('required_fields')) {
    $summary[] = $this
      ->t('Mark as required');
  }
  return $summary;
}