X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fimage_widget_crop%2Fsrc%2FImageWidgetCropInterface.php;fp=web%2Fmodules%2Fcontrib%2Fimage_widget_crop%2Fsrc%2FImageWidgetCropInterface.php;h=3d135ec95cf0e57133bce24e33eb811290191896;hb=eba34333e3c89f208d2f72fa91351ad019a71583;hp=0000000000000000000000000000000000000000;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/modules/contrib/image_widget_crop/src/ImageWidgetCropInterface.php b/web/modules/contrib/image_widget_crop/src/ImageWidgetCropInterface.php new file mode 100644 index 000000000..3d135ec95 --- /dev/null +++ b/web/modules/contrib/image_widget_crop/src/ImageWidgetCropInterface.php @@ -0,0 +1,226 @@ + + * Coordinates (x-axis & y-axis) of crop selection zone. + */ + public function getAxisCoordinates(array $axis, array $crop_selection); + + /** + * Get the size and position of the crop. + * + * @param array $field_values + * The original values of image. + * @param array $properties + * The original height of image. + * + * @return null|array + * The data dimensions (width & height) into this ImageStyle. + */ + public function getCropOriginalDimension(array $field_values, array $properties); + + /** + * Get one effect instead of ImageStyle. + * + * @param \Drupal\image\Entity\ImageStyle $image_style + * The ImageStyle to get data. + * @param string $data_type + * The type of data needed in current ImageStyle. + * + * @return mixed|null + * The effect data in current ImageStyle. + */ + public function getEffectData(ImageStyle $image_style, $data_type); + + /** + * Get the imageStyle using this crop_type. + * + * @param string $crop_type_name + * The id of the current crop_type entity. + * + * @return array + * All imageStyle used by this crop_type. + */ + public function getImageStylesByCrop($crop_type_name); + + /** + * Apply different operation on ImageStyles. + * + * @param array $image_styles + * All ImageStyles used by this cropType. + * @param string $file_uri + * Uri of image uploaded by user. + * @param bool $create_derivative + * Boolean to create an derivative of the image uploaded. + */ + public function imageStylesOperations(array $image_styles, $file_uri, $create_derivative = FALSE); + + /** + * Update existent crop entity properties. + * + * @param \Drupal\crop\Entity\Crop $crop + * The crop object loaded. + * @param array $crop_properties + * The machine name of ImageStyle. + */ + public function updateCropProperties(Crop $crop, array $crop_properties); + + /** + * Load all crop using the ImageStyles. + * + * @param array $image_styles + * All ImageStyle for this current CROP. + * @param CropType $crop_type + * The entity CropType. + * @param string $file_uri + * Uri of uploded file. + * + * @return array + * All crop used this ImageStyle. + */ + public function loadImageStyleByCrop(array $image_styles, CropType $crop_type, $file_uri); + + /** + * Compare crop zone properties when user saved one crop. + * + * @param array $crop_properties + * The crop properties after saved the form. + * @param array $old_crop + * The crop properties save in this crop entity, + * Only if this crop already exist. + * + * @return bool + * Return true if properties is not identical. + */ + public function cropHasChanged(array $crop_properties, array $old_crop); + + /** + * Verify if ImageStyle is correctly configured. + * + * @param array $styles + * The list of available ImageStyle. + * + * @return array + * The list of styles filtred. + */ + public function getAvailableCropImageStyle(array $styles); + + /** + * Verify if the crop is used by a ImageStyle. + * + * @param array $crop_list + * The list of existent Crop Type. + * + * @return array + * The list of Crop Type filtred. + */ + public function getAvailableCropType(array $crop_list); + + /** + * Get All sizes properties of the crops for an file. + * + * @param \Drupal\crop\Entity\Crop $crop + * All crops attached to this file based on URI. + * + * @return array + * Get all crop zone properties (x, y, height, width), + */ + public static function getCropProperties(Crop $crop); + + /** + * Fetch all fields FileField and use "image_crop" element on an entity. + * + * @param \Drupal\Core\Entity\EntityInterface $entity + * The entity object. + */ + public function buildCropToEntity(EntityInterface $entity); + + /** + * Fetch all form elements using image_crop element. + * + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The current state of the form. + */ + public function buildCropToForm(FormStateInterface $form_state); + +}