You are here

protected function ImageAPIOptimizeProcessorAddForm::prepareImageAPIOptimizeProcessor in Image Optimize (or ImageAPI Optimize) 4.x

Same name and namespace in other branches
  1. 8.3 src/Form/ImageAPIOptimizeProcessorAddForm.php \Drupal\imageapi_optimize\Form\ImageAPIOptimizeProcessorAddForm::prepareImageAPIOptimizeProcessor()
  2. 8.2 src/Form/ImageAPIOptimizeProcessorAddForm.php \Drupal\imageapi_optimize\Form\ImageAPIOptimizeProcessorAddForm::prepareImageAPIOptimizeProcessor()

Converts an image optimize processor ID into an object.

Parameters

string $imageapi_optimize_processor: The image optimize processor ID.

Return value

\Drupal\imageapi_optimize\ImageAPIOptimizeProcessorInterface The image optimize processor object.

Overrides ImageAPIOptimizeProcessorFormBase::prepareImageAPIOptimizeProcessor

File

src/Form/ImageAPIOptimizeProcessorAddForm.php, line 56

Class

ImageAPIOptimizeProcessorAddForm
Provides an add form for image optimize processors.

Namespace

Drupal\imageapi_optimize\Form

Code

protected function prepareImageAPIOptimizeProcessor($imageapi_optimize_processor) {
  $imageapi_optimize_processor = $this->processorManager
    ->createInstance($imageapi_optimize_processor);

  // Set the initial weight so this processor comes last.
  $imageapi_optimize_processor
    ->setWeight(count($this->imageAPIOptimizePipeline
    ->getProcessors()));
  return $imageapi_optimize_processor;
}