コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state)
 {
     $element = parent::formElement($items, $delta, $element, $form, $form_state);
     $element['#imagefield_crop_show_preview'] = $this->getSetting('show_preview');
     $element['#imagefield_crop_resolution'] = $this->getSetting('resolution');
     $element['#imagefield_crop_croparea'] = $this->getSetting('croparea');
     $element['#imagefield_crop_enforce_ratio'] = $this->getSetting('enforce_ratio');
     $element['#imagefield_crop_enforce_minimum'] = $this->getSetting('enforce_minimum');
     return $element;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state)
 {
     $field_settings = $this->getFieldSettings();
     // Add properties needed by process() method.
     $element['#crop_list'] = $this->getSetting('crop_list');
     $element['#crop_preview_image_style'] = $this->getSetting('crop_preview_image_style');
     // Set an custom upload_location.
     $element['#upload_location'] = 'public://crop/pictures/';
     return parent::formElement($items, $delta, $element, $form, $form_state);
 }