You are here

function hook_styleguide in Style Guide 6

Same name and namespace in other branches
  1. 7 styleguide.api.php \hook_styleguide()

Register a style guide element for display.

hook_styleguide() defines an array of items to render for theme testing. Each item is rendered as an element on the style guide page.

Each item should be keyed with a unique identifier. This value will be used to create a named anchor link on the Style Guide page.

Options: -- 'title' (required). A string indicating the element name. -- 'description' (optional). A short description of the item. -- 'content' (required). A string or renderable array of content to present. May be used in conjunction with a 'tag' element, or used instead of a theme callback. -- 'tag' (optional). A string indicating a valid HTML tag (wihout <>). This tag will be wrapped around the content. In Drupal 7, this element is deprecated in favor of theme_html_tag(). -- 'attributes' (optional). An array of attributes to apply to a tag element. -- 'group' (optional). A string indicating the context of this element. Groups are organized within the preview interface. If no group is provided, the item will be assigned to the 'Common' group.

Return value

$items An array of items to render.

1 function implements hook_styleguide()

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

styleguide_styleguide in ./styleguide.styleguide.inc
Implements hook_styleguide().
1 invocation of hook_styleguide()
styleguide_page in ./styleguide.module
The styleguide page.

File

./styleguide.api.php, line 29

Code

function hook_styleguide() {
  $items['ul'] = array(
    'title' => t('Unordered list'),
    'content' => theme('item_list', styleguide_list()),
    'group' => t('Common'),
  );
  $items['text'] = array(
    'title' => t('Text block'),
    'content' => styleguide_paragraph(3),
    'group' => t('Text'),
    'description' => t('A block of three paragraphs'),
  );
  $items['h1'] = array(
    'title' => t('Text block'),
    'tag' => 'h1',
    'content' => styleguide_word(3),
    'group' => t('Text'),
  );
  $items['div-format'] = array(
    'title' => t('Div special'),
    'description' => t('Add the "format" class to emphasize an entire section.'),
    'tag' => 'div',
    'attributes' => array(
      'class' => 'format',
    ),
    'content' => styleguide_paragraph(1),
  );
  return $items;
}