You are here

function hook_icon_bundles in Icon API 7

Same name and namespace in other branches
  1. 8 icon.api.php \hook_icon_bundles()

Define information about icon bundles.

Return value

array An associative array containing:

  • bundle_name: A unique machine name and an associative array containing:

    • render: Required, name of the rendering hook this bundle should use. If omitted or the rendering hook is not implemented, then this bundle will be ignored.
    • icons: Required, an associative array containing icon data. This array requires a unique key name for each icon. The value may be a string or array and entirely depends on which render hook is being used. If unsure, study the render hook's theme_icon_RENDER() implementation.
    • title: Optional, human readable title for the bundle. If omitted, it will fall back to using the bundle_name.
    • provider: Optional, name of the bundle provider. If omitted, it will fall back to using the machine name of the extension that implements this hook.
    • url: Optional, URL for more information regarding the bundle.
    • version: Optional, supplemental information for identifying the bundle version.
    • path: Optional, path to where the bundle's resource files are located. If omitted, it will fall back to using the path of the extension that implements this hook.
    • settings: Optional, an array containing setting data. The structure of this array entirely depends on which render hook is be used. If unsure, study the render hook's theme_icon_RENDER() implementation.
    • #attached: Optional, an associative array containing additional resources to be loaded with the bundle. This allows render hooks the ability to specify external resources that contain the necessary code for the icons to function properly, such as a CSS file for sprites.

See also

icon_icon_bundles()

icon_bundle_load()

icon_bundles()

icon_bundle_defaults()

1 function implements hook_icon_bundles()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

icon_icon_bundles in includes/bundles.inc
Implements hook_icon_bundles().

File

./icon.api.php, line 82
icon.api.php Hooks and form elements provided by the Icon API module.

Code

function hook_icon_bundles() {
  $bundles['my_bundle'] = array(
    'render' => 'image',
    'title' => t('My Bundle'),
    'provider' => t('ACME Inc.'),
    'url' => 'http://example.com',
    'version' => 'v2',
    'path' => drupal_get_path('module', 'my_module') . '/icons',
    'icons' => array(
      'alert' => 'Message: Alert',
      'info' => 'Message: Info',
      'warning' => 'Message: Warning',
    ),
    'settings' => array(
      // Defaults to 'png' for the render hook: image.
      'extension' => 'gif',
    ),
    '#attached' => array(
      'css' => array(),
      'js' => array(),
      'library' => array(),
      // To invoke "callback_function($arg1, $arg2, $arg3)"
      'callback_function' => array(
        array(
          '$arg1',
          '$arg2',
          '$arg3',
        ),
      ),
    ),
  );
  return $bundles;
}