public function Dimension::settingsSummary in Dimension 8
Same name and namespace in other branches
- 2.1.x src/Plugin/Field/FieldWidget/Dimension.php \Drupal\dimension\Plugin\Field\FieldWidget\Dimension::settingsSummary()
 - 2.0.x src/Plugin/Field/FieldWidget/Dimension.php \Drupal\dimension\Plugin\Field\FieldWidget\Dimension::settingsSummary()
 
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 NumberWidget::settingsSummary
File
- src/
Plugin/ Field/ FieldWidget/ Dimension.php, line 66  
Class
Namespace
Drupal\dimension\Plugin\Field\FieldWidgetCode
public function settingsSummary() {
  $summary = array();
  /** @noinspection StaticInvocationViaThisInspection */
  foreach ($this
    ->fields() as $key => $label) {
    $settings = $this
      ->getSetting($key);
    $placeholder = $settings['placeholder'];
    if (!empty($placeholder)) {
      $summary[] = $this
        ->t('@label: @placeholder', array(
        '@label' => $settings['label'],
        '@placeholder' => $placeholder,
      ));
    }
    else {
      $summary[] = $this
        ->t('@label: No placeholder', array(
        '@label' => $settings['label'],
      ));
    }
  }
  return $summary;
}