diff --git a/src/Plugin/Field/FieldWidget/FocalPointImageWidget.php b/src/Plugin/Field/FieldWidget/FocalPointImageWidget.php index 80c290e..a72e29d 100644 --- a/src/Plugin/Field/FieldWidget/FocalPointImageWidget.php +++ b/src/Plugin/Field/FieldWidget/FocalPointImageWidget.php @@ -29,11 +29,11 @@ class FocalPointImageWidget extends ImageWidget { */ public static function defaultSettings() { return [ - 'progress_indicator' => 'throbber', - 'preview_image_style' => 'thumbnail', - 'preview_link' => TRUE, - 'offsets' => '50,50', - ] + parent::defaultSettings(); + 'progress_indicator' => 'throbber', + 'preview_image_style' => 'thumbnail', + 'preview_link' => TRUE, + 'offsets' => '50,50', + ] + parent::defaultSettings(); } /** @@ -45,19 +45,27 @@ class FocalPointImageWidget extends ImageWidget { // We need a preview image for this widget. $form['preview_image_style']['#required'] = TRUE; unset($form['preview_image_style']['#empty_option']); + // @todo Implement https://www.drupal.org/node/2872960 + // The preview image should not be generated using a focal point effect + // and should maintain teh aspect ratio of the original image. + $form['preview_image_style']['#description'] = t( + $form['preview_image_style']['#description']->getUntranslatedString() . "
Do not choose an image style that alters the aspect ratio of the original image nor an image style that uses a focal point effect.", + $form['preview_image_style']['#description']->getArguments(), + $form['preview_image_style']['#description']->getOptions() + ); $form['preview_link'] = [ '#type' => 'checkbox', - '#title' => $this->t('Preview link'), + '#title' => $this->t('Display preview link'), '#default_value' => $this->getSetting('preview_link'), '#weight' => 30, ]; $form['offsets'] = [ '#type' => 'textfield', - '#title' => $this->t('Focal point offsets'), + '#title' => $this->t('Default focal point value'), '#default_value' => $this->getSetting('offsets'), - '#description' => $this->t('Specify the default focus of this widget in the form "leftoffset,topoffset" where offsets are in percentages. Ex: 25,75.'), + '#description' => $this->t('Specify the default focal point of this widget in the form "leftoffset,topoffset" where offsets are in percentages. Ex: 25,75.'), '#size' => 7, '#maxlength' => 7, '#element_validate' => [[$this, 'validateFocalPointWidget']], @@ -78,7 +86,7 @@ class FocalPointImageWidget extends ImageWidget { $summary[] = $this->t('Preview link: @status', array('@status' => $status)); $offsets = $this->getSetting('offsets'); - $summary[] = $this->t('Offsets: @offsets', array('@offsets' => $offsets)); + $summary[] = $this->t('Default focal point: @offsets', array('@offsets' => $offsets)); return $summary; }