You are here

function openlayers_ui_get_style_plugin_form in Openlayers 6.2

Get options of a style plugin by plugin name

2 calls to openlayers_ui_get_style_plugin_form()
openlayers_ui_styles_form in modules/openlayers_ui/includes/openlayers_ui.styles.inc
Styles add/edit form.
openlayers_ui_style_plugin_ahah in modules/openlayers_ui/includes/openlayers_ui.styles.inc

File

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

Code

function openlayers_ui_get_style_plugin_form($plugname, $defaults) {
  $form = array();
  $available = openlayers_style_plugins();
  if (!$available[$plugname]) {
    watchdog('openlayers_ui', 'Style plugin !name unknown', array(
      '!name' => $plugname,
    ), WATCHDOG_ERROR);
    return $form;
  }
  $plugin = $available[$plugname];
  $plugin_class = ctools_plugin_get_class($plugin, 'style_plugin');
  if (empty($plugin_class)) {
    watchdog('openlayers_ui', 'Style plugin !name does not have a class?!', array(
      '!name' => $plugname,
    ), WATCHDOG_ERROR);
    return $form;
  }

  // Create object and ask it for options
  $style_plugin = new $plugin_class();
  $form = array(
    '#type' => 'fieldset',
    '#tree' => TRUE,
    '#description' => $plugin['description'],
    'conf' => $style_plugin
      ->options_form($defaults),
  );
  return $form;
}