You are here

public function RoyalSliderFormatter::settingsSummary in RoyalSlider Integration 8

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

string[] A short summary of the formatter settings.

Overrides FormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/RoyalSliderFormatter.php, line 122
Contains \Drupal\royalslider\Plugin\Field\FieldFormatter\RoyalSliderFormatter.

Class

RoyalSliderFormatter
Plugin implementation of the 'royalslider' formatter.

Namespace

Drupal\royalslider\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = array();
  $optionsets = royalslider_optionset_options(FALSE);

  // Unset possible 'No defined optionset' option.
  unset($optionsets['']);

  // Optionsets could be lost because of enabled/disabled modules that defines
  // their styles in code.
  $optionset_setting = $this
    ->getSetting('royalslider_optionset');
  if (isset($optionsets[$optionset_setting])) {
    $summary[] = t('OptionSet: @optionset', array(
      '@optionset' => $optionsets[$optionset_setting],
    ));
  }
  else {
    $summary[] = t('Default options');
  }
  return $summary;
}