You are here

function geofield_ymap_plugin_style_geofield_ymap::options_form in Geofield Yandex Maps 7

Options form.

Overrides views_plugin_style::options_form

File

./geofield_ymap_plugin_style_geofield_ymap.inc, line 34

Class

geofield_ymap_plugin_style_geofield_ymap

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $field_options = array(
    '' => t('< none >'),
  );
  $fields = $this->display->handler
    ->get_handlers('field');
  foreach ($fields as $id => $handler) {
    $field_options[$id] = $handler
      ->ui_name(FALSE);
  }
  $form['map_type'] = array(
    '#type' => 'select',
    '#title' => t('Map type'),
    '#options' => _geofield_ymap_get_map_types(),
    '#default_value' => $this->options['map_type'],
  );
  $form['map_center'] = array(
    '#type' => 'textfield',
    '#title' => t('Map center'),
    '#default_value' => $this->options['map_center'],
    '#size' => 40,
  );
  $form['map_zoom'] = array(
    '#type' => 'textfield',
    '#title' => t('Map zoom'),
    '#default_value' => $this->options['map_zoom'],
    '#size' => 5,
  );
  $form['map_auto_centering'] = array(
    '#type' => 'checkbox',
    '#title' => t('Map auto centering'),
    '#default_value' => $this->options['map_auto_centering'],
  );
  $form['map_auto_zooming'] = array(
    '#type' => 'checkbox',
    '#title' => t('Map auto zooming'),
    '#default_value' => $this->options['map_auto_zooming'],
  );
  $form['map_clusterize'] = array(
    '#type' => 'checkbox',
    '#title' => t('Clusterize placemarks'),
    '#default_value' => $this->options['map_clusterize'],
  );
  $form['map_hide_empty'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide empty map'),
    '#default_value' => $this->options['map_hide_empty'],
  );
  $form['map_save_state'] = array(
    '#type' => 'checkbox',
    '#title' => t('Save user zoom and center'),
    '#default_value' => $this->options['map_save_state'],
  );
  $form['hint_content_field'] = array(
    '#type' => 'select',
    '#title' => t('Hint content field'),
    '#options' => $field_options,
    '#default_value' => $this->options['hint_content_field'],
  );
  $form['icon_content_field'] = array(
    '#type' => 'select',
    '#title' => t('Icon content field'),
    '#options' => $field_options,
    '#default_value' => $this->options['icon_content_field'],
  );
  $form['cluster_caption_field'] = array(
    '#type' => 'select',
    '#title' => t('Cluster caption field'),
    '#options' => $field_options,
    '#default_value' => $this->options['cluster_caption_field'],
  );
  $form['preset_field'] = array(
    '#type' => 'select',
    '#title' => t('Preset field'),
    '#description' => t('Use next modules for replace field value to preset name: !modules', array(
      '!modules' => '
          <a href="https://drupal.org/sandbox/xandeadx/2205151" target="_blank">Views field replace value</a>,
          <a href="https://drupal.org/project/views_regex_rewrite" target="_blank">Views Regex Rewrite</a>,
          <a href="https://drupal.org/project/views_fieldrewrite" target="_blank">Views Field Rewrite</a>
        ',
    )),
    '#options' => $field_options,
    '#default_value' => $this->options['preset_field'],
  );
  $form['map_object_preset'] = array(
    '#type' => 'textfield',
    '#title' => t('Default objects preset'),
    '#description' => t('Default <a href="@url" target="_blank">preset name</a>. Example: <code>islands#blueCircleDotIcon</code>', array(
      '@url' => 'http://api.yandex.ru/maps/doc/jsapi/2.1/ref/reference/option.presetStorage.xml',
    )),
    '#default_value' => $this->options['map_object_preset'],
    '#size' => 40,
  );
  $form['map_controls'] = array(
    '#type' => 'textfield',
    '#title' => t('Controls'),
    '#description' => t('<a href="@url" target="_blank">Controls</a> through a comma, or controls set name. Use <code>&lt;none&gt;</code> to hide all controls. Example: <code>fullscreenControl,searchControl</code>. Default set name: <code>default</code>', array(
      '@url' => 'http://api.yandex.ru/maps/doc/jsapi/2.1/ref/reference/control.Manager.xml#add',
    )),
    '#default_value' => $this->options['map_controls'],
    '#size' => 40,
  );
  $form['map_behaviors'] = array(
    '#type' => 'textfield',
    '#title' => t('Behaviors'),
    '#description' => t('<a href="@url" target="_blank">Map behaviors</a> through a comma. Use <code>&lt;none&gt;</code> to disable all behaviors. Default value: <code>default</code>', array(
      '@url' => 'http://api.yandex.ru/maps/doc/jsapi/2.1/ref/reference/map.behavior.Manager.xml#param-behaviors',
    )),
    '#default_value' => $this->options['map_behaviors'],
    '#size' => 40,
  );
  $form['additional_settings'] = array(
    '#title' => t('Additional settings'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['additional_settings']['object_options'] = array(
    '#title' => t('Object options'),
    '#description' => t('Additional object options in JSON format. <a href="!url" target="_blank">Options list</a>. Example: !example', array(
      '!url' => 'http://api.yandex.ru/maps/doc/jsapi/2.1/ref/reference/GeoObject.xml#constructor-summary',
      '!example' => '
          <code><br />
            {<br />
            &nbsp;&nbsp;"iconLayout": "default#image",<br />
            &nbsp;&nbsp;"iconImageHref": "http://api.yandex.ru/maps/doc/jsapi/2.x/examples/images/myIcon.gif",<br />
            &nbsp;&nbsp;"iconImageSize": [30, 42],<br />
            &nbsp;&nbsp;"iconImageOffset": [-3, -42]<br />
            }
          </code>
        ',
    )),
    '#type' => 'textarea',
    '#default_value' => $this->options['additional_settings']['object_options'],
  );
  $form['additional_settings']['object_options_use_tokens'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use replacement tokens (reduce performance)'),
    '#default_value' => $this->options['additional_settings']['object_options_use_tokens'],
  );
}