You are here

public function ImageCropWidget::getSetting in Lightning Media 8

Same name and namespace in other branches
  1. 8.4 modules/lightning_media_image/src/Plugin/Field/FieldWidget/ImageCropWidget.php \Drupal\lightning_media_image\Plugin\Field\FieldWidget\ImageCropWidget::getSetting()
  2. 8.2 modules/lightning_media_image/src/Plugin/Field/FieldWidget/ImageCropWidget.php \Drupal\lightning_media_image\Plugin\Field\FieldWidget\ImageCropWidget::getSetting()
  3. 8.3 modules/lightning_media_image/src/Plugin/Field/FieldWidget/ImageCropWidget.php \Drupal\lightning_media_image\Plugin\Field\FieldWidget\ImageCropWidget::getSetting()

File

modules/lightning_media_image/src/Plugin/Field/FieldWidget/ImageCropWidget.php, line 42

Class

ImageCropWidget

Namespace

Drupal\lightning_media_image\Plugin\Field\FieldWidget

Code

public function getSetting($key) {
  $value = parent::getSetting($key);

  // If no crop types are chosen, allow all of them.
  if ($key == 'crop_list' && empty($value)) {
    $value = CropType::getCropTypeNames();
    $value = $this->imageWidgetCropManager
      ->getAvailableCropType($value);
    $value = array_keys($value);
  }
  return $value;
}