You are here

function variable_form_element_default in Variable 6

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

Build default form element

2 calls to variable_form_element_default()
variable_form_element in ./variable.form.inc
Build form element for a variable
variable_form_element_options in ./variable.form.inc
Build options variables

File

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

Code

function variable_form_element_default($variable) {
  $element = isset($variable['form_element']) ? $variable['form_element'] : array();
  $element += array(
    '#title' => $variable['title'],
    '#description' => $variable['description'],
  );
  if (!isset($element['#default_value'])) {
    $element['#default_value'] = variable_get_value($variable['name']);
  }
  return $element;
}