You are here

public function FieldLimiter::settingsSummary in Field Limiter 8

File

src/Plugin/Field/FieldFormatter/FieldLimiter.php, line 78

Class

FieldLimiter
Plugin implementation of the 'field_limiter' formatter.

Namespace

Drupal\field_limiter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $offset = $this
    ->getSetting('offset') + 1;
  $limit = $this
    ->getSetting('limit');
  if ($limit == 0) {
    $summary[] = $this
      ->t('Showing all values, starting at @offset.', array(
      '@offset' => $offset,
    ));
  }
  else {
    $summary[] = $this
      ->formatPlural($limit, 'Limited to 1 value, starting at @offset.', 'Limited to @count values, starting at @offset.', array(
      '@offset' => $offset,
    ));
  }
  return $summary;
}