You are here

function variable_form_element_text_format in Variable 7

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

Build form element for text_format variable.

1 string reference to 'variable_form_element_text_format'
variable_variable_type_info in ./variable.variable.inc
Implements hook_variable_type_info().

File

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

Code

function variable_form_element_text_format($variable, $options = array()) {
  $variable += array(
    'element' => array(),
    'title' => '',
    'description' => '',
  );
  $type = variable_get_type($variable['type']) + array(
    'element' => array(),
  );
  $element = $variable['element'] + array(
    '#title' => $variable['title'],
    '#description' => $variable['description'],
  ) + $type['element'];
  $value = variable_get_value($variable, $options);
  if (isset($value) && is_array($value)) {
    if (isset($value['value'])) {
      $element['#default_value'] = $value['value'];
    }
    if (isset($value['format'])) {
      $element['#format'] = $value['format'];
    }
  }
  return $element;
}