Same name and namespace in other branches
  1. 8.x-2.x src/Plugin/Field/FieldWidget/ColorFieldWidgetGrid.php \Drupal\color_field\Plugin\Field\FieldWidget\ColorFieldWidgetGrid::settingsSummary() 1 comment

File

src/Plugin/Field/FieldWidget/ColorFieldWidgetGrid.php, line 79

Class

ColorFieldWidgetGrid
Plugin implementation of the 'color_field_default' widget.

Namespace

Drupal\color_field\Plugin\Field\FieldWidget

Code

public function settingsSummary() : array {
    $summary = [];
    $cell_width = $this->getSetting('cell_width');
    $cell_height = $this->getSetting('cell_height');
    $cell_margin = $this->getSetting('cell_margin');
    $box_width = $this->getSetting('box_width');
    $box_height = $this->getSetting('box_height');
    $columns = $this->getSetting('columns');
    if (!empty($cell_width)) {
        $summary[] = $this->t('Cell width: @cell_width', [
            '@cell_width' => $cell_width,
        ]);
    }
    if (!empty($cell_height)) {
        $summary[] = $this->t('Cell height: @cell_height', [
            '@cell_height' => $cell_height,
        ]);
    }
    if (!empty($cell_margin)) {
        $summary[] = $this->t('Cell margin: @cell_margin', [
            '@cell_margin' => $cell_margin,
        ]);
    }
    if (!empty($box_width)) {
        $summary[] = $this->t('Box width: @box_width', [
            '@box_width' => $box_width,
        ]);
    }
    if (!empty($box_height)) {
        $summary[] = $this->t('Box height: @box_height', [
            '@box_height' => $box_height,
        ]);
    }
    if (!empty($columns)) {
        $summary[] = $this->t('Columns: @columns', [
            '@columns' => $columns,
        ]);
    }
    if (empty($summary)) {
        $summary[] = $this->t('No placeholder');
    }
    return $summary;
}