You are here

public function MdStarRatingWidget::settingsSummary in Star Rating Form Display 8

Returns a short summary for the current widget settings.

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

Return value

array A short summary of the widget settings.

Overrides WidgetBase::settingsSummary

File

src/Plugin/Field/FieldWidget/MdStarRatingWidget.php, line 136

Class

MdStarRatingWidget
Plugin implementation of the 'starrating' widget.

Namespace

Drupal\starrating_formdisplay\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = [];
  $field_settings = $this
    ->getFieldSettings();
  $max = $field_settings['max_value'];
  $min = 0;
  $icon_type = $this
    ->getSetting('icon_type');
  $icon_color = $this
    ->getSetting('icon_color');
  $fill_blank = $this
    ->getSetting('fill_blank');
  $elements = [
    '#theme' => 'starrating_formatter',
    '#min' => $min,
    '#max' => $max,
    '#icon_type' => $icon_type,
    '#icon_color' => $icon_color,
    '#fill_blank' => $fill_blank,
  ];
  $elements['#attached']['library'][] = 'starrating/' . $icon_type;
  $summary[] = $elements;
  return $summary;
}