You are here

public function SocialPostAlbumImageWidget::getSetting in Open Social 10.1.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_post/modules/social_post_album/src/Plugin/Field/FieldWidget/SocialPostAlbumImageWidget.php \Drupal\social_post_album\Plugin\Field\FieldWidget\SocialPostAlbumImageWidget::getSetting()
  2. 10.0.x modules/social_features/social_post/modules/social_post_album/src/Plugin/Field/FieldWidget/SocialPostAlbumImageWidget.php \Drupal\social_post_album\Plugin\Field\FieldWidget\SocialPostAlbumImageWidget::getSetting()
  3. 10.2.x modules/social_features/social_post/modules/social_post_album/src/Plugin/Field/FieldWidget/SocialPostAlbumImageWidget.php \Drupal\social_post_album\Plugin\Field\FieldWidget\SocialPostAlbumImageWidget::getSetting()

Returns the value of a setting, or its default value if absent.

Parameters

string $key: The setting name.

Return value

mixed The setting value.

Overrides PluginSettingsBase::getSetting

File

modules/social_features/social_post/modules/social_post_album/src/Plugin/Field/FieldWidget/SocialPostAlbumImageWidget.php, line 101

Class

SocialPostAlbumImageWidget
Plugin implementation of the 'social_post_album_image' widget.

Namespace

Drupal\social_post_album\Plugin\Field\FieldWidget

Code

public function getSetting($key) {
  if ($key === 'preview_image_style' && $this->fieldDefinition
    ->getTargetEntityTypeId() === 'post' && $this->routeMatch
    ->getRouteName() !== 'entity.post.edit_form') {
    return 'social_x_large';
  }
  return parent::getSetting($key);
}