You are here

private function DefaultCropHandler::deleteExistingCrop in CMS Content Sync 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/cms_content_sync/entity_handler/DefaultCropHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler\DefaultCropHandler::deleteExistingCrop()
  2. 2.1.x src/Plugin/cms_content_sync/entity_handler/DefaultCropHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler\DefaultCropHandler::deleteExistingCrop()

Delete already existing Crop entity.

Parameters

$file:

1 call to DefaultCropHandler::deleteExistingCrop()
DefaultCropHandler::pull in src/Plugin/cms_content_sync/entity_handler/DefaultCropHandler.php
Pull the remote entity.

File

src/Plugin/cms_content_sync/entity_handler/DefaultCropHandler.php, line 140

Class

DefaultCropHandler
Class DefaultCropHandler, providing a minimalistic implementation for the crop entity type.

Namespace

Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler

Code

private function deleteExistingCrop(PullIntent $intent, $file) {
  $moduleHandler = \Drupal::service('module_handler');
  if ($moduleHandler
    ->moduleExists('crop')) {
    $crop = Crop::findCrop($file
      ->getFileUri(), $intent
      ->getBundle());
    if ($crop && $crop
      ->uuid() != $intent
      ->getUuid()) {
      $crop
        ->delete();
    }
  }
}