class SlickParagraphsFormatter in Slick Paragraphs 8.2
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldFormatter/SlickParagraphsFormatter.php \Drupal\slick_paragraphs\Plugin\Field\FieldFormatter\SlickParagraphsFormatter
Plugin implementation of the 'Slick Paragraphs Media' formatter.
Plugin annotation
@FieldFormatter(
  id = "slick_paragraphs_media",
  label = @Translation("Slick Paragraphs Media"),
  description = @Translation("Display the rich paragraph as a Slick Carousel."),
  field_types = {
    "entity_reference_revisions"
  },
  quickedit = {
    "editor" = "disabled"
  }
)
Hierarchy
- class \Drupal\slick\Plugin\Field\FieldFormatter\SlickEntityReferenceFormatterBase extends \Drupal\blazy\Dejavu\BlazyEntityReferenceBase implements ContainerFactoryPluginInterface uses SlickFormatterTrait- class \Drupal\slick\Plugin\Field\FieldFormatter\SlickMediaFormatter uses SlickFormatterViewTrait- class \Drupal\slick_paragraphs\Plugin\Field\FieldFormatter\SlickParagraphsFormatter
 
 
- class \Drupal\slick\Plugin\Field\FieldFormatter\SlickMediaFormatter uses SlickFormatterViewTrait
Expanded class hierarchy of SlickParagraphsFormatter
File
- src/Plugin/ Field/ FieldFormatter/ SlickParagraphsFormatter.php, line 23 
Namespace
Drupal\slick_paragraphs\Plugin\Field\FieldFormatterView source
class SlickParagraphsFormatter extends SlickMediaFormatter {
  /**
   * Overrides the scope for the form elements.
   */
  public function getScopedFormElements() {
    $admin = $this
      ->admin();
    $target_type = $this
      ->getFieldSetting('target_type');
    $views_ui = $this
      ->getFieldSetting('handler') == 'default';
    $bundles = $views_ui ? [] : $this
      ->getFieldSetting('handler_settings')['target_bundles'];
    $media = $admin
      ->getFieldOptions($bundles, [
      'entity_reference',
    ], $target_type, 'media');
    $stages = $admin
      ->getFieldOptions($bundles, [
      'image',
      'entity_reference',
    ], $target_type);
    return [
      'images' => $stages,
      'overlays' => $stages + $media,
    ] + parent::getScopedFormElements();
  }
  /**
   * {@inheritdoc}
   */
  public static function isApplicable(FieldDefinitionInterface $field_definition) {
    $storage = $field_definition
      ->getFieldStorageDefinition();
    // Excludes host, prevents complication with multiple nested paragraphs.
    $paragraph = $storage
      ->getTargetEntityTypeId() === 'paragraph';
    return $paragraph && $storage
      ->isMultiple() && $storage
      ->getSetting('target_type') === 'paragraph';
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| SlickEntityReferenceFormatterBase:: | protected | property | The logger factory. | |
| SlickEntityReferenceFormatterBase:: | public | function | ||
| SlickEntityReferenceFormatterBase:: | public static | function | Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: | |
| SlickEntityReferenceFormatterBase:: | public static | function | ||
| SlickFormatterTrait:: | protected | property | The image factory service. | |
| SlickFormatterTrait:: | protected | property | The slick field formatter manager. | |
| SlickFormatterTrait:: | public | function | Returns the slick admin service shortcut. | |
| SlickFormatterTrait:: | public | function | Builds the settings. Aliased as: traitBuildSettings | 1 | 
| SlickFormatterTrait:: | public | function | Returns the slick field formatter service. | |
| SlickFormatterTrait:: | public | function | Defines the common scope for both front and admin. | |
| SlickFormatterTrait:: | public | function | Defines the common scope for the form elements. | |
| SlickFormatterTrait:: | public | function | Returns the image factory. | |
| SlickFormatterTrait:: | protected static | function | Injects DI services. | |
| SlickFormatterTrait:: | public | function | Returns the slick service. | |
| SlickFormatterTrait:: | public | function | ||
| SlickFormatterViewTrait:: | public | function | Returns similar view elements. | |
| SlickMediaFormatter:: | public | function | Returns the blazy manager. | |
| SlickMediaFormatter:: | public | function | Builds the settings. | |
| SlickMediaFormatter:: | public | function | ||
| SlickParagraphsFormatter:: | public | function | Overrides the scope for the form elements. Overrides SlickMediaFormatter:: | |
| SlickParagraphsFormatter:: | public static | function | Overrides SlickMediaFormatter:: | 
