You are here

private function ip_geoloc_plugin_style_leaflet::_add_sync in IP Geolocation Views & Maps 7

1 call to ip_geoloc_plugin_style_leaflet::_add_sync()
ip_geoloc_plugin_style_leaflet::options_form in views/ip_geoloc_plugin_style_leaflet.inc
Implements options_form().

File

views/ip_geoloc_plugin_style_leaflet.inc, line 579

Class

ip_geoloc_plugin_style_leaflet

Code

private function _add_sync(&$form, &$weight) {
  $form['sync'] = array(
    '#title' => t('Cross-highlighting between map markers and page content outside the map'),
    '#description' => '<br/>' . t('For the cross-highlighting to work, content outside the map must have the CSS class <em>.sync-id-[nid]</em>, where <em>[nid]</em> represents the content ID.') . ' ' . t('For Views content, you can do this by adding a <strong>Row class</strong> to the Grid, Table, HTML or Unformatted list formats of your Views Attachment or Block displays.'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => empty($this->options['sync'][LEAFLET_SYNC_CONTENT_TO_MARKER]),
    '#weight' => $weight++,
  );
  $note = t('You can redefine this class to change the default look.');
  $form['sync'][LEAFLET_SYNC_CONTENT_TO_MARKER] = array(
    '#title' => t('When hovering markers on the map, highlight associated content on the page'),
    '#type' => 'checkbox',
    '#default_value' => $this->options['sync'][LEAFLET_SYNC_CONTENT_TO_MARKER] && $this->options['sync'][LEAFLET_SYNC_MARKER_TO_CONTENT],
    '#description' => t('Content is highlighted dynamically through the automatic addition of the CSS class <em>.synced-marker-hover</em>.') . ' ' . $note,
    '#weight' => $weight++,
  );
  $caveat = t('For this feature to work in combination with any <em>sorting</em> on the hovered content, the associated Views display must have <em>Use Ajax: No</em>.');
  $form['sync'][LEAFLET_SYNC_MARKER_TO_CONTENT] = array(
    '#title' => t('When hovering content, highlight associated markers on the map'),
    '#type' => 'checkbox',
    '#default_value' => $this->options['sync'][LEAFLET_SYNC_MARKER_TO_CONTENT],
    '#description' => t('Markers are highlighted dynamically through the automatic addition of the CSS class <em>.synced-content-hover</em>.') . ' ' . $note . '<br/>' . $caveat,
    '#weight' => $weight++,
  );
  $form['sync'][LEAFLET_SYNC_MARKER_TO_CONTENT_WITH_POPUP] = array(
    '#title' => t('As above, but also pop up marker balloons'),
    '#type' => 'checkbox',
    '#default_value' => $this->options['sync'][LEAFLET_SYNC_MARKER_TO_CONTENT_WITH_POPUP],
    '#states' => array(
      'visible' => array(
        ':input[name="style_options[sync][4]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
    '#weight' => $weight++,
  );
  $form['sync'][LEAFLET_SYNC_REVERT_LAST_MARKER_ON_MAP_OUT] = array(
    '#title' => t('Unhighlight marker and close its balloon when hovering off the map'),
    '#type' => 'checkbox',
    '#default_value' => $this->options['sync'][LEAFLET_SYNC_REVERT_LAST_MARKER_ON_MAP_OUT],
    '#states' => array(
      'visible' => array(
        ':input[name="style_options[sync][4]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
    '#weight' => $weight++,
  );
}