You are here

public function ImageStyleWithPipeline::getPipelineEntity in Image Optimize (or ImageAPI Optimize) 4.x

Same name and namespace in other branches
  1. 8.3 src/Entity/ImageStyleWithPipeline.php \Drupal\imageapi_optimize\Entity\ImageStyleWithPipeline::getPipelineEntity()
  2. 8.2 src/Entity/ImageStyleWithPipeline.php \Drupal\imageapi_optimize\Entity\ImageStyleWithPipeline::getPipelineEntity()

Return value

\Drupal\imageapi_optimize\Entity\ImageAPIOptimizePipeline|null

1 call to ImageStyleWithPipeline::getPipelineEntity()
ImageStyleWithPipeline::hasPipeline in src/Entity/ImageStyleWithPipeline.php

File

src/Entity/ImageStyleWithPipeline.php, line 44

Class

ImageStyleWithPipeline

Namespace

Drupal\imageapi_optimize\Entity

Code

public function getPipelineEntity() {
  if (!empty($this->pipeline)) {
    $storage = $this
      ->entityTypeManager()
      ->getStorage('imageapi_optimize_pipeline');
    if ($this->pipeline == '__default__') {
      if ($default_pipeline_name = \Drupal::config('imageapi_optimize.settings')
        ->get('default_pipeline')) {
        $pipelineId = $default_pipeline_name;
      }
    }
    else {
      $pipelineId = $this->pipeline;
    }
    if (!empty($pipelineId) && ($pipeline = $storage
      ->load($pipelineId))) {
      return $pipeline;
    }
  }
}