You are here

function variable_form_element in Variable 6

Same name and namespace in other branches
  1. 7.2 variable.form.inc \variable_form_element()
  2. 7 variable.form.inc \variable_form_element()

Build form element for a variable

2 calls to variable_form_element()
variable_edit_form in ./variable.module
Build edit form for one or multiple variables
variable_form_element_multiple in ./variable.form.inc
Build multiple form element

File

./variable.form.inc, line 11
Variable API module. Form library.

Code

function variable_form_element($variable) {
  if (!empty($variable['form_callback'])) {
    $element = call_user_func($variable['form_callback'], $variable);
  }
  elseif (!empty($variable['children'])) {
    $element = variable_form_element_multiple($variable);
  }
  else {
    $element = variable_form_element_default($variable);
  }
  if (!empty($variable['access'])) {
    $element['#access'] = $variable['access'];
  }
  return $element;
}