function openlayers_map_form_preview in Openlayers 7.3
Map preview form handler.
1 string reference to 'openlayers_map_form_preview'
- openlayers_ui_OpenlayersMaps_ctools_export_ui in modules/
openlayers_ui/ src/ Plugin/ export_ui/ OpenlayersMaps.inc - CTools Export UI plugin definition.
File
- modules/
openlayers_ui/ src/ Plugin/ export_ui/ OpenlayersMaps.inc, line 767 - CTools Export UI plugin definition for maps.
Code
function openlayers_map_form_preview($form, &$form_state) {
$map = \Drupal\openlayers\Openlayers::load('map', $form_state['item']);
$form['preview'] = array(
'#type' => 'openlayers',
'#map' => $map,
);
$alternative_template = 'openlayers--' . str_replace('_', '-', $map
->getMachineName()) . '.tpl.php';
$value = file_get_contents(drupal_get_path('module', 'openlayers') . '/theme/openlayers.tpl.php');
$form['information']['theme'] = array(
'#weight' => 20,
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => 'Theming information',
'template_content' => array(
'#title' => 'Openlayers map template',
'#type' => 'textarea',
'#default_value' => $value,
'#value' => $value,
'#description' => t("The default Openlayers template is <strong>openlayers.tpl.php</strong> for all the maps. You may override it by creating a file with the same name in your theme template's directory. You can also name it <em>openlayers--[map_machine_name].tpl.php</em> if you want to alter the display of this particular map only. For example: <strong>@template</strong>.", array(
'@template' => $alternative_template,
)),
),
);
return $form;
}