You are here

function geofield_widget_openlayers_afterbuild in Geofield 7

Callback for afterbuild for widget for js addition to

1 string reference to 'geofield_widget_openlayers_afterbuild'
geofield_field_widget_form in ./geofield.widgets.inc
Implements hook_field_widget_form().

File

./geofield.widgets.inc, line 215
Provides field widget hooks for geofield module.

Code

function geofield_widget_openlayers_afterbuild($element, &$form_state) {
  $instance = field_widget_instance($element, $form_state);
  $widget = $instance['widget'];
  $settings = $widget['settings'];
  drupal_add_js(array(
    'geofield' => array(
      'data_storage' => !empty($settings['data_storage']) ? $settings['data_storage'] : 'collection',
    ),
  ), 'setting');
  $defaults = array();
  $element['helpmap'] = array(
    '#markup' => '<div class="form-item geotaxonomy-latlon-helpmap" style="display:block">' . geofield_form_latlon_map(array(), $element['#openlayers_mapname']) . '</div>',
  );
  $element['helpmap_desc'] = array(
    '#markup' => t('<div class="description geofield-help">Use the icons to select what type of feature to draw. Each map can contain one simple feature. Pan and zoom with arrows and the zoom bar.</div>'),
  );
  return $element;
}