29 'background' =>
false,
59 if (isset($entity_coords[
'x1'], $entity_coords[
'x2'], $entity_coords[
'y1'], $entity_coords[
'y2'])) {
61 'x' => $entity_coords[
'x1'],
62 'y' => $entity_coords[
'y1'],
63 'width' => $entity_coords[
'x2'] - $entity_coords[
'x1'],
64 'height' => $entity_coords[
'y2'] - $entity_coords[
'y1'],
72 $cropper_aspect_ratio_size =
elgg_extract(
'cropper_aspect_ratio_size',
$vars,
'master');
73 if ($cropper_aspect_ratio_size ===
false) {
87 if (!isset($sizes[$cropper_aspect_ratio_size]) && $cropper_aspect_ratio_size !==
'master') {
89 $cropper_aspect_ratio_size =
'master';
92 if (!isset($sizes[$cropper_aspect_ratio_size])) {
97 $width = (int)
elgg_extract(
'w', $sizes[$cropper_aspect_ratio_size]);
98 $height = (int)
elgg_extract(
'h', $sizes[$cropper_aspect_ratio_size]);
100 if (empty($width) || empty($height)) {
106 $detect_aspect_ratio(
$vars);
125 foreach ([
'x1',
'y1',
'x2',
'y2'] as $coord) {
128 'name' =>
"{$input_name}_{$coord}",
136 'name' =>
"_entity_edit_icon_crop[{$input_name}][guid]",
141 'name' =>
"_entity_edit_icon_crop[{$input_name}][type]",
152 require([
'entity/edit/icon/crop'],
function(Cropper) {
153 var cropper =
new Cropper();
155 cropper.init(
'input[type="file"][name="<?php echo elgg_extract('name', $vars, 'icon'); ?>"]');
if($entity instanceof ElggEntity) if(!isset($cropper_data['aspectRatio'])) $img_url
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($entity_type=null, $entity_subtype=null, $type= 'icon')
Returns a configuration array of icon sizes.
if($entity instanceof ElggEntity &&$entity->hasIcon('master', $icon_type)) $img
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
elgg require
Throw an error if the required package isn't present.
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
if($item instanceof\ElggEntity) elseif($item instanceof\ElggRiverItem) elseif($item instanceof ElggRelationship) elseif(is_callable([$item, 'getType']))
elgg echo
Translates a string.
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.