You are here

function _webform_select_options_callback in Webform 7.4

Same name and namespace in other branches
  1. 6.3 components/select.inc \_webform_select_options_callback()
  2. 7.3 components/select.inc \_webform_select_options_callback()

Execute a select option callback.

Parameters

string $name: The name of the options group.

array $component: The full Webform component.

bool $flat: Whether the information returned should exclude any nested groups.

1 call to _webform_select_options_callback()
_webform_select_options in components/select.inc
Generate a list of options for a select list.

File

components/select.inc, line 975
Webform module multiple select component.

Code

function _webform_select_options_callback($name, $component, $flat = FALSE) {
  $info = _webform_select_options_info();

  // Include any necessary files.
  if (isset($info[$name]['file'])) {
    $pathinfo = pathinfo($info[$name]['file']);
    $path = ($pathinfo['dirname'] ? $pathinfo['dirname'] . '/' : '') . basename($pathinfo['basename'], '.' . $pathinfo['extension']);
    module_load_include($pathinfo['extension'], $info[$name]['module'], $path);
  }

  // Execute the callback function.
  if (isset($info[$name]['options callback']) && is_callable($info[$name]['options callback'])) {
    $function = $info[$name]['options callback'];
    $arguments = array();
    if (isset($info[$name]['options arguments'])) {
      $arguments = $info[$name]['options arguments'];
    }
    return $function($component, $flat, $arguments);
  }
}