You are here

function openlayers_source_form_start in Openlayers 7.3

Source base config form handler.

1 string reference to 'openlayers_source_form_start'
openlayers_ui_OpenlayersSources_ctools_export_ui in modules/openlayers_ui/src/Plugin/export_ui/OpenlayersSources.inc
CTools Export UI plugin definition.

File

modules/openlayers_ui/src/Plugin/export_ui/OpenlayersSources.inc, line 73
CTools Export UI plugin definition for sources.

Code

function openlayers_source_form_start($form, &$form_state) {
  $class = new \Drupal\openlayers_ui\UI\OpenlayersSources();
  $class
    ->init($form_state['plugin']);
  $class
    ->edit_form($form, $form_state);
  $options = array();
  foreach (\Drupal\openlayers\Openlayers::loadAllExportable('Layer') as $machine_name => $layer) {
    if (!is_object($layer) || property_exists($layer, 'disabled') && ($layer->disabled == 1 || $layer->disabled == TRUE)) {
      continue;
    }
    $options[$machine_name] = $layer->name;
  }
  $form['attachToLayer'] = array(
    '#type' => 'select',
    '#title' => 'Add this to a layer ?',
    '#empty_option' => t('- Do no attach -'),
    '#description' => 'Select the layer to add this object to.',
    '#options' => $options,
    '#default_value' => isset($form_state['item']->attachToLayer) ? $form_state['item']->attachToLayer : '',
  );
  return $form;
}