You are here

protected function ImageAPIOptimizePipelineEditForm::updateProcessorWeights in Image Optimize (or ImageAPI Optimize) 4.x

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

Updates image optimize processor weights.

Parameters

array $processors: Associative array with processors having processor uuid as keys and array with processor data as values.

1 call to ImageAPIOptimizePipelineEditForm::updateProcessorWeights()
ImageAPIOptimizePipelineEditForm::submitForm in src/Form/ImageAPIOptimizePipelineEditForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…

File

src/Form/ImageAPIOptimizePipelineEditForm.php, line 264

Class

ImageAPIOptimizePipelineEditForm
Controller for image optimize pipeline edit form.

Namespace

Drupal\imageapi_optimize\Form

Code

protected function updateProcessorWeights(array $processors) {
  foreach ($processors as $uuid => $processor_data) {
    if ($this->entity
      ->getProcessors()
      ->has($uuid)) {
      $this->entity
        ->getProcessor($uuid)
        ->setWeight($processor_data['weight']);
    }
  }
}