You are here

function callback_webform_options in Webform 7.4

Define a list of options that Webform may use in a select component.

Callback for hook_webform_select_options_info().

Parameters

$component: The Webform component array for the select component being displayed.

$flat: Boolean value indicating whether the returned list needs to be a flat array of key => value pairs. Select components support up to one level of nesting, but when results are displayed, the list needs to be returned without the nesting.

$arguments: The "options arguments" specified in hook_webform_select_options_info().

Return value

array An array of key => value pairs suitable for a select list's #options FormAPI property.

Related topics

File

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

Code

function callback_webform_options($component, $flat, $arguments) {
  $options = array(
    'one' => t('Pre-built option one'),
    'two' => t('Pre-built option two'),
    'three' => t('Pre-built option three'),
  );
  return $options;
}