Skip to content
Snippets Groups Projects

Simplify getCropEntity method in FocalPointManager

Open Marc Philipps requested to merge issue/focal_point-3105826:2.x into 2.x
1 file
+ 6
10
Compare changes
  • Side-by-side
  • Inline
+ 6
10
@@ -65,29 +65,25 @@ class FocalPointManager implements FocalPointManagerInterface {
];
}
/**
/**
* {@inheritdoc}
*/
public function getCropEntity(FileInterface $file, $crop_type) {
if (Crop::cropExists($file->getFileUri(), $crop_type)) {
/** @var \Drupal\crop\CropInterface $crop */
$crop = Crop::findCrop($file->getFileUri(), $crop_type);
}
else {
$crop = Crop::findCrop($file->getFileUri(), $crop_type);
if (!$crop) {
$values = [
'type' => $crop_type,
'entity_id' => $file->id(),
'entity_type' => 'file',
'uri' => $file->getFileUri(),
];
$crop = $this->cropStorage
->create($values);
$crop = $this->cropStorage->create($values);
}
return $crop;
}
/**
* {@inheritdoc}
*/
Loading