function image_hotspots_widget in Image Hotspots 7.2
Create a widget to create and manage hotspots.
Parameters
array $element: Form element of the image.
array $hotspot_settings: Array with widget settings.
1 call to image_hotspots_widget()
- image_hotspots_process_form_element in ./
image_hotspots.module - After build function to process the hotspot widget on forms.
File
- ./
image_hotspots.module, line 268 - Main function of module.
Code
function image_hotspots_widget(array &$element, array $hotspot_settings) {
$output = '';
if (isset($element['#file']->uri)) {
$image_style = array(
'style_name' => IMAGE_HOTSPOTS_STYLE,
'path' => $element['#file']->uri,
'width' => $element['width']['#value'],
'height' => $element['height']['#value'],
);
$output .= theme_image_style($image_style);
$attached_js = array(
array(
'data' => array(
'image_hotspot_settings' => $hotspot_settings,
),
'type' => 'setting',
),
drupal_get_path('module', 'image_hotspots') . '/themes/jcrop/jquery.Jcrop.min.js',
drupal_get_path('module', 'image_hotspots') . '/themes/jquery.json-2.4.min.js',
drupal_get_path('module', 'image_hotspots') . '/themes/image_hotspots.js',
);
$attached_css = array(
drupal_get_path('module', 'image_hotspots') . '/themes/jcrop/jquery.Jcrop.min.css',
drupal_get_path('module', 'image_hotspots') . '/themes/image_hotspots.css',
);
$js = isset($element['#attached']['js']) ? $element['#attached']['js'] : array();
$css = isset($element['#attached']['css']) ? $element['#attached']['css'] : array();
$element['#attached']['js'] = array_merge($js, $attached_js);
$element['#attached']['css'] = array_merge($css, $attached_css);
}
return $output;
}