You are here

function geofield_ymap_field_formatter_settings_form in Geofield Yandex Maps 7

Implements hook_field_formatter_settings_form().

File

./geofield_ymap.formatter.inc, line 30

Code

function geofield_ymap_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $settings = $instance['display'][$view_mode]['settings'];
  $element['map_type'] = array(
    '#type' => 'select',
    '#title' => t('Map type'),
    '#options' => _geofield_ymap_get_map_types(),
    '#default_value' => $settings['map_type'],
  );
  $element['map_center'] = array(
    '#type' => 'textfield',
    '#title' => t('Map center'),
    '#description' => t('Map center coordinates: Longtitude,Latitude'),
    '#default_value' => $settings['map_center'],
    '#size' => 30,
  );
  $element['map_zoom'] = array(
    '#type' => 'textfield',
    '#title' => t('Map zoom'),
    '#description' => t('From 1 to 16'),
    '#default_value' => $settings['map_zoom'],
    '#size' => 5,
  );
  $element['map_auto_centering'] = array(
    '#type' => 'checkbox',
    '#title' => t('Map auto centering'),
    '#default_value' => $settings['map_auto_centering'],
  );
  $element['map_auto_zooming'] = array(
    '#type' => 'checkbox',
    '#title' => t('Map auto zooming'),
    '#default_value' => $settings['map_auto_zooming'],
  );
  $element['map_clusterize'] = array(
    '#type' => 'checkbox',
    '#title' => t('Clusterize placemarks'),
    '#default_value' => $settings['map_clusterize'],
  );
  $element['map_object_preset'] = array(
    '#type' => 'textfield',
    '#title' => t('Objects preset'),
    '#description' => t('Objects <a href="@url" target="_blank">preset name</a>. Example: <code>islands#blackDotIcon</code>', array(
      '@url' => 'http://api.yandex.ru/maps/doc/jsapi/2.1/ref/reference/option.presetStorage.xml',
    )),
    '#default_value' => $settings['map_object_preset'],
    '#size' => 30,
  );
  $element['map_object_balloon'] = array(
    '#type' => 'textfield',
    '#title' => t('Balloon content'),
    '#description' => t('Balloon content. Allowed tokens.'),
    '#default_value' => $settings['map_object_balloon'],
    '#size' => 30,
  );
  if (module_exists('token')) {
    $element['map_object_balloon']['#description'] .= ' ' . theme('token_tree', array(
      'token_types' => array(
        $instance['entity_type'],
      ),
      'dialog' => TRUE,
    ));
  }
  $element['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' => $settings['map_controls'],
    '#size' => 30,
  );
  $element['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' => $settings['map_behaviors'],
    '#size' => 30,
  );
  return $element;
}