You are here

function galleria_option_element in Galleria 7

Returns the form element to use to edit the given option.

1 call to galleria_option_element()
galleria_form_optionset_edit in includes/galleria.admin.inc
Form builder; Form to edit a given option set.

File

includes/galleria.admin.inc, line 500
Administrative page callbacks for the galleria module.

Code

function galleria_option_element($option, $value) {
  $elements = galleria_option_elements();
  if (isset($elements[$option])) {
    $element = $elements[$option];
  }
  else {
    $element = array(
      '#type' => 'textfield',
      '#description' => t('Automatic type conversion: Use the special strings "TRUE" or "FALSE" to specify boolean values. Numeric values are passed to Galleria as float, everything else as string.'),
    );
  }
  if ($value !== NULL) {
    if ($element['#type'] == 'select') {
      if ($value === TRUE) {
        $value = 'true';
      }
      elseif ($value === FALSE) {
        $value = 'false';
      }
    }
    $element['#default_value'] = $value;
  }
  return $element;
}