Commit b604245b authored by Ken Greenslade's avatar Ken Greenslade Committed by Ken Greenslade
Browse files

Issue #3275967 by ken-g: Map preview not shown if height is relative

parent 9b1e0449
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -790,6 +790,12 @@ function openlayers_map_form_preview($form, &$form_state) {
    '#map' => $map,
  );

  //  If the map height is specified as relative, force the previewed map height to 400px to ensure that a map is displayed 
  if ($form['preview']['#map']->getOption('height') && substr($form['preview']['#map']->getOption('height'), -1) == '%') {
    $form['preview']['#map']->setOption('height', '400px');
    drupal_set_message('Map height set to 400px for preview purposes only, as original map height was set to a non-absolute value.', 'warning');
  }

  $alternative_template = 'openlayers--' . str_replace('_', '-', $map->getMachineName()) . '.tpl.php';

  $value = file_get_contents(drupal_get_path('module', 'openlayers') . '/theme/openlayers.tpl.php');