You are here

function hook_webform_select_options_info in Webform 6.3

Same name and namespace in other branches
  1. 7.4 webform.api.php \hook_webform_select_options_info()
  2. 7.3 webform.api.php \hook_webform_select_options_info()

Define callbacks that can be used as select list options.

When users create a select component, they may select a pre-built list of certain options. Webform core provides a few of these lists such as the United States, countries of the world, and days of the week. This hook provides additional lists that may be utilized.

Return value

An array of callbacks that can be used for select list options. This array should be keyed by the "name" of the pre-defined list. The values should be an array with the following additional keys:

  • title: The translated title for this list.
  • options callback: The name of the function that will return the list.
  • options arguments: Any additional arguments to send to the callback.
  • file: Optional. The file containing the options callback, relative to the module root.

See also

webform_options_example()

hook_webform_select_options_info_alter()

Related topics

1 function implements hook_webform_select_options_info()

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

webform_webform_select_options_info in ./webform.module
Implements hook_webform_select_options_info().
1 invocation of hook_webform_select_options_info()
_webform_select_options_info in components/select.inc
Load Webform select option info from 3rd party modules.

File

./webform.api.php, line 37
Sample hooks demonstrating usage in Webform.

Code

function hook_webform_select_options_info() {
  $items = array();
  $items['days'] = array(
    'title' => t('Days of the week'),
    'options callback' => 'webform_options_days',
    'file' => 'includes/webform.options.inc',
  );
  return $items;
}