function hook_widgets_element_info in Widgets 7
Define information about image elements provided by a module.
This hook enables modules to define image manipulation elements for use with an image set.
Return value
An array of image elements. This array is keyed on the machine-readable element name. Each element is defined as an associative array containing the following items:
- "label": The human-readable name of the element.
- "element callback": The function to call to perform this image element.
- "dimensions passthrough": (optional) Set this item if the element doesn't change the dimensions of the image.
- "dimensions callback": (optional) The function to call to transform dimensions for this element.
- "help": (optional) A brief description of the element that will be shown when adding or configuring this image element.
- "form callback": (optional) The name of a function that will return a $form array providing a configuration form for this image element.
- "summary theme": (optional) The name of a theme function that will output a summary of this image element's configuration.
See also
hook_widgets_element_info_alter()
2 functions implement hook_widgets_element_info()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- widgets_service_links_widgets_element_info in modules/
widgets_service_links/ widgets_service_links.module - Implements hook_widgets_element_info().
- widgets_widgets_element_info in ./
widgets.elements.inc - Implements hook_widgets_element_info().
1 invocation of hook_widgets_element_info()
- widgets_element_definitions in ./
widgets.module - Pull in widget elements exposed by modules implementing hook_widgets_element_info().
File
- ./
widgets.api.php, line 40 - Hooks related to widget sets and widgets. TODO: Update API docs NOTICE: This file has been copied from the image module and has not been updated for use with Widgets yet.
Code
function hook_widgets_element_info() {
$elements = array();
$elements['mymodule_resize'] = array(
'label' => t('Resize'),
'help' => t('Resize an image to an exact set of dimensions, ignoring aspect ratio.'),
'element callback' => 'mymodule_resize_element',
'dimensions callback' => 'mymodule_resize_dimensions',
'form callback' => 'mymodule_resize_form',
'summary theme' => 'mymodule_resize_summary',
);
return $elements;
}