public static function ImageCrop::getCropFormPropertyValue in Image Widget Crop 8
Same name and namespace in other branches
- 8.2 src/Element/ImageCrop.php \Drupal\image_widget_crop\Element\ImageCrop::getCropFormPropertyValue()
Get default value of property elements.
Parameters
array $element: All form elements without crop properties.
string $crop_type: The id of the current crop.
bool $edit: Context of this form.
int|null $value: The values calculated by ImageCrop::getCropFormProperties().
string $property: Name of current property @see setCoordinatesElement().
Return value
int|null Value of this element.
1 call to ImageCrop::getCropFormPropertyValue()
- ImageCrop::getCropFormElement in src/
Element/ ImageCrop.php - Inject crop elements into the form.
File
- src/
Element/ ImageCrop.php, line 336
Class
- ImageCrop
- Provides a form element for crop.
Namespace
Drupal\image_widget_crop\ElementCode
public static function getCropFormPropertyValue(array &$element, $crop_type, $edit, $value, $property) {
// Standard case.
if (!empty($edit) && isset($value)) {
return $value;
}
// Populate value when ajax populates values after process.
if (isset($element['#value']) && isset($element['crop_wrapper'])) {
$ajax_element =& $element['#value']['crop_wrapper']['container'][$crop_type]['values'];
return isset($ajax_element[$property]) && !empty($ajax_element[$property]) ? $ajax_element[$property] : NULL;
}
return NULL;
}