private function IpGeoLocPluginStyleLeaflet::addSync in IP Geolocation Views & Maps 8
Form part definition.
1 call to IpGeoLocPluginStyleLeaflet::addSync()
- IpGeoLocPluginStyleLeaflet::buildOptionsForm in src/
Plugin/ views/ style/ IpGeoLocPluginStyleLeaflet.php - Provide a form to edit options for this plugin.
File
- src/
Plugin/ views/ style/ IpGeoLocPluginStyleLeaflet.php, line 592
Class
- IpGeoLocPluginStyleLeaflet
- Views Style plugin extension for Leaflet (if enabled).
Namespace
Drupal\ip_geoloc\Plugin\views\styleCode
private function addSync(&$form, &$weight) {
$form['sync'] = [
'#title' => $this
->t('Cross-highlighting between map markers and page content outside the map'),
'#description' => '<br/>' . $this
->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.') . ' ' . $this
->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 = $this
->t('You can redefine this class to change the default look.');
$form['sync'][LEAFLET_SYNC_CONTENT_TO_MARKER] = [
'#title' => $this
->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' => $this
->t('Content is highlighted dynamically through the automatic addition of the CSS class <em>.synced-marker-hover</em>.') . ' ' . $note,
'#weight' => $weight++,
];
$caveat = $this
->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] = [
'#title' => $this
->t('When hovering content, highlight associated markers on the map'),
'#type' => 'checkbox',
'#default_value' => $this->options['sync'][LEAFLET_SYNC_MARKER_TO_CONTENT],
'#description' => $this
->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] = [
'#title' => $this
->t('As above, but also pop up marker balloons'),
'#type' => 'checkbox',
'#default_value' => $this->options['sync'][LEAFLET_SYNC_MARKER_TO_CONTENT_WITH_POPUP],
'#states' => [
'visible' => [
':input[name="style_options[sync][4]"]' => [
'checked' => TRUE,
],
],
],
'#weight' => $weight++,
];
$form['sync'][LEAFLET_SYNC_REVERT_LAST_MARKER_ON_MAP_OUT] = [
'#title' => $this
->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' => [
'visible' => [
':input[name="style_options[sync][4]"]' => [
'checked' => TRUE,
],
],
],
'#weight' => $weight++,
];
}