diff --git a/core/lib/Drupal/Core/Field/FormatterBase.php b/core/lib/Drupal/Core/Field/FormatterBase.php index cd3e28f..6e6242b 100644 --- a/core/lib/Drupal/Core/Field/FormatterBase.php +++ b/core/lib/Drupal/Core/Field/FormatterBase.php @@ -112,10 +112,7 @@ public function view(FieldItemListInterface $items, $langcode = NULL) { * Returns the cardinality setting of the field instance. */ protected function getCardinality() { - if ($this->fieldDefinition instanceof \Drupal\Core\Field\FieldDefinitionInterface) { - return $this->fieldDefinition->getFieldStorageDefinition()->getCardinality(); - } - return 0; + return $this->fieldDefinition->getFieldStorageDefinition()->getCardinality(); } /** @@ -163,13 +160,13 @@ public function settingsForm(array $form, FormStateInterface $form_state) { public function settingsSummary() { $summary = []; $limit = $this->getSetting('limit'); - $offset = $this->getSetting('offset'); - if ($this->getCardinality() == 1 || (empty($limit) && empty($offset))) { + if ($this->getCardinality() == 1 || empty($limit)) { return $summary; } - $summary[] = $this->t('Display %limit items, skip %offset items.', [ + $offset = $this->getSetting('offset'); + $summary[] = $this->t('Display %limit items, skip %offset item(s).', [ '%limit' => $limit, '%offset' => $offset ]);