You are here

function hook_widgets_default_sets in Widgets 7

Provide module-based image sets for reuse throughout Drupal.

This hook allows your module to provide image sets. This may be useful if you require images to fit within exact dimensions. Note that you should attempt to re-use the default sets provided by Image module whenever possible, rather than creating image sets that are specific to your module. Image provides the sets "thumbnail", "medium", and "large".

You may use this hook to more easily manage your site's changes by moving existing image sets from the database to a custom module. Note however that moving image sets to code instead storing them in the database has a negligible element on performance, since custom image sets are loaded from the database all at once. Even if all sets are pulled from modules, Image module will still perform the same queries to check the database for any custom sets.

Return value

An array of image sets, keyed by the set name.

See also

widgets_widgets_default_sets()

1 function implements hook_widgets_default_sets()

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_default_sets in modules/widgets_service_links/widgets_service_links.module
1 invocation of hook_widgets_default_sets()
widgets_sets in ./widgets.module
Get an array of all sets and their settings.

File

./widgets.api.php, line 178
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_default_sets() {
  $sets = array();
  $sets['mymodule_preview'] = array(
    'elements' => array(
      array(
        'name' => 'widgets_scale',
        'data' => array(
          'width' => 400,
          'height' => 400,
          'upscale' => 1,
        ),
        'weight' => 0,
      ),
      array(
        'name' => 'widgets_desaturate',
        'data' => array(),
        'weight' => 1,
      ),
    ),
  );
  return $sets;
}