public function ImageWidgetCropManager::updateCropProperties in Image Widget Crop 8
Same name and namespace in other branches
- 8.2 src/ImageWidgetCropManager.php \Drupal\image_widget_crop\ImageWidgetCropManager::updateCropProperties()
 
Update existent crop entity properties.
Parameters
\Drupal\crop\Entity\Crop $crop: The crop object loaded.
array $crop_properties: The machine name of ImageStyle.
1 call to ImageWidgetCropManager::updateCropProperties()
- ImageWidgetCropManager::updateCrop in src/
ImageWidgetCropManager.php  - Update old crop with new properties choose in UI.
 
File
- src/
ImageWidgetCropManager.php, line 328  
Class
- ImageWidgetCropManager
 - ImageWidgetCropManager calculation class.
 
Namespace
Drupal\image_widget_cropCode
public function updateCropProperties(Crop $crop, array $crop_properties) {
  // Parse all properties if this crop have changed.
  foreach ($crop_properties as $crop_coordinate => $value) {
    // Edit the crop properties if he have changed.
    $crop
      ->set($crop_coordinate, $value, TRUE);
  }
  $crop
    ->save();
}