You are here

function openlayers_component_form_start in Openlayers 7.3

Component base config form handler.

1 string reference to 'openlayers_component_form_start'
openlayers_ui_OpenlayersComponents_ctools_export_ui in modules/openlayers_ui/src/Plugin/export_ui/OpenlayersComponents.inc
CTools Export UI plugin definition.

File

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

Code

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