You are here

public static function FineImageUpload::process in Fine Image Upload 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldWidget/FineImageUpload.php \Drupal\fiu\Plugin\Field\FieldWidget\FineImageUpload::process()

Form API callback: Processes a image_image field element.

Expands the image_image type to include the alt and title fields.

This method is assigned as a #process callback in formElement() method.

Overrides ImageWidget::process

File

src/Plugin/Field/FieldWidget/FineImageUpload.php, line 71

Class

FineImageUpload
Plugin implementation of the 'fine_image' widget.

Namespace

Drupal\fiu\Plugin\Field\FieldWidget

Code

public static function process($element, FormStateInterface $form_state, $form) {
  $element = parent::process($element, $form_state, $form);
  $element['#theme'] = 'fine_image_widget';
  if (isset($element['upload_button'])) {
    $element['upload_button']['#ajax']['progress']['type'] = 'fiu_progress';
  }
  if (isset($element['remove_button'])) {
    $element['remove_button']['#ajax']['progress']['type'] = 'fiu_progress';
  }
  return $element;
}