You are here

function openlayers_ui_get_layer_form in Openlayers 6.2

Get an actual layer form

1 call to openlayers_ui_get_layer_form()
openlayers_ui_layers_form in modules/openlayers_ui/includes/openlayers_ui.layers.inc
Layer add/edit form.

File

modules/openlayers_ui/includes/openlayers_ui.layers.inc, line 114
This file holds the functions handling layers in the Openlayers UI.

Code

function openlayers_ui_get_layer_form($type, $layer = FALSE) {
  $form = array();

  // @TODO: clarify use of data, and of layer_type in overriding it
  $form['data'] = array(
    '#tree' => TRUE,
    '#type' => 'fieldset',
    '#title' => '',
    '#description' => '',
  );
  $form['name'] = array(
    '#type' => 'textfield',
    '#default_value' => isset($type->name) ? $type->name : '',
    '#title' => t('Layer Name'),
    '#description' => t('This is the unique name of the layer. It must contain only alphanumeric characters and underscores.'),
  );
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Layer Title'),
    '#default_value' => isset($type->title) ? $type->title : '',
    '#description' => t('The friendly name of your layer, which will appear in the administration interface.'),
  );
  $form['description'] = array(
    '#type' => 'textfield',
    '#title' => t('Layer Description'),
    '#default_value' => isset($type->description) ? $type->description : '',
  );

  // Arrays merged in order so that options_form can override defaults
  $form['data'] = $type
    ->options_form() + $form['data'];
  return $form;
}