29 'background' =>
false,
46 'height' => $entity_coords[
'y2'] - $entity_coords[
'y1'],
58 $cropper_aspect_ratio_size =
elgg_extract(
'cropper_aspect_ratio_size',
$vars,
'master');
59 if ($cropper_aspect_ratio_size ===
false) {
73 if (!isset($sizes[$cropper_aspect_ratio_size]) && $cropper_aspect_ratio_size !==
'master') {
75 $cropper_aspect_ratio_size =
'master';
78 if (!isset($sizes[$cropper_aspect_ratio_size])) {
83 $width = (int)
elgg_extract(
'w', $sizes[$cropper_aspect_ratio_size]);
84 $height = (int)
elgg_extract(
'h', $sizes[$cropper_aspect_ratio_size]);
86 if (empty($width) || empty($height)) {
93 $detect_aspect_ratio(
$vars);
113 'alt' =>
elgg_echo(
'entity:edit:icon:crop:img:alt'),
119 foreach ([
'x1',
'y1',
'x2',
'y2'] as $coord) {
122 'name' =>
"{$input_name}_{$coord}",
130 'name' =>
"_entity_edit_icon_crop[{$input_name}][guid]",
135 'name' =>
"_entity_edit_icon_crop[{$input_name}][type]",
146 import(
'entity/edit/icon/crop').then((Cropper) => {
147 var cropper =
new Cropper.default();
148 cropper.init(
'input[type="file"][name="<?php echo elgg_extract('name', $vars, 'icon'); ?>"]');
elgg_require_css(string $view)
Register a CSS view name to be included in the HTML head.
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
elgg_get_icon_sizes(string $entity_type=null, string $entity_subtype=null, $type= 'icon')
Returns a configuration array of icon sizes.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
if($entity instanceof\ElggEntity) if(!isset($cropper_data['aspectRatio'])) $img_url
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
if($entity instanceof\ElggEntity &&$entity->hasIcon('master', $icon_type)) if(isset($cropper_data['existingAspectRatio'], $cropper_data['aspectRatio'])) $img