You are here

protected function ImageFormatter::presentationLabel in Facebook Instant Articles 3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/ImageFormatter.php \Drupal\fb_instant_articles\Plugin\Field\FieldFormatter\ImageFormatter::presentationLabel()

Given a presentation machine name, return the label.

Parameters

string $presentation: Presentation type name.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup String label.

2 calls to ImageFormatter::presentationLabel()
ImageFormatter::settingsForm in src/Plugin/Field/FieldFormatter/ImageFormatter.php
Returns a form to configure settings for the formatter.
ImageFormatter::settingsSummary in src/Plugin/Field/FieldFormatter/ImageFormatter.php
Returns a short summary for the current formatter settings.

File

src/Plugin/Field/FieldFormatter/ImageFormatter.php, line 206

Class

ImageFormatter
Plugin implementation of the 'fbia_image' formatter.

Namespace

Drupal\fb_instant_articles\Plugin\Field\FieldFormatter

Code

protected function presentationLabel($presentation) {
  switch ($presentation) {
    case Image::ASPECT_FIT:
      $label = $this
        ->t('Fit');
      break;
    case Image::ASPECT_FIT_ONLY:
      $label = $this
        ->t('Fit only');
      break;
    case Image::FULLSCREEN:
      $label = $this
        ->t('Fullscreen');
      break;
    case Image::NON_INTERACTIVE:
      $label = $this
        ->t('Non-interactive');
      break;
    default:
      $label = $this
        ->t('None');
      break;
  }
  return $label;
}