protected function _get_controls($args)
{
$controls = [];
$image_sizes = $this->_get_image_sizes();
if (!empty($args['default']) && isset($image_sizes[$args['default']])) {
$default_value = $args['default'];
} else {
// Get the first item for default value
$default_value = array_keys($image_sizes);
$default_value = array_shift($default_value);
}
$controls['size'] = ['label' => _x('Image Size', 'Image Size Control', 'elementor'), 'type' => Controls_Manager::SELECT, 'options' => $image_sizes, 'default' => $default_value, 'label_block' => false];
if (isset($image_sizes['custom'])) {
$controls['custom_dimension'] = ['label' => _x('Image Dimension', 'Image Size Control', 'elementor'), 'type' => Controls_Manager::IMAGE_DIMENSIONS, 'description' => __('You can crop the original image size to any custom size. You can also set a single value for height or width in order to keep the original size ratio.', 'elementor'), 'condition' => ['size' => ['custom']], 'separator' => 'none'];
}
return $controls;
}