You are here

public function StarRatingValueFormatter::settingsSummary in Star Rating 8

Same name and namespace in other branches
  1. 8.4 src/Plugin/Field/FieldFormatter/StarRatingValueFormatter.php \Drupal\starrating\Plugin\Field\FieldFormatter\StarRatingValueFormatter::settingsSummary()
  2. 8.2 src/Plugin/Field/FieldFormatter/StarRatingValueFormatter.php \Drupal\starrating\Plugin\Field\FieldFormatter\StarRatingValueFormatter::settingsSummary()
  3. 8.3 src/Plugin/Field/FieldFormatter/StarRatingValueFormatter.php \Drupal\starrating\Plugin\Field\FieldFormatter\StarRatingValueFormatter::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

string[] A short summary of the formatter settings.

Overrides FormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/StarRatingValueFormatter.php, line 44

Class

StarRatingValueFormatter
Plugin implementation of the 'addtocart' formatter.

Namespace

Drupal\starrating\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $field_settings = $this
    ->getFieldSettings();
  $max = $field_settings['max_value'];
  $output = '<div class="starrating">' . $max . '</div>';
  $elements = [];
  $elements['#markup'] = $output;
  $summary[] = $elements;
  return $summary;
}