You are here

function location_quickgeocode_locationapi in GMap Addons 7

Same name and namespace in other branches
  1. 5 location_quickgeocode/location_quickgeocode.module \location_quickgeocode_locationapi()
  2. 6 location_quickgeocode/location_quickgeocode.module \location_quickgeocode_locationapi()

Implementation of hook_locationapi().

File

location_quickgeocode/location_quickgeocode.module, line 34
Short description.

Code

function location_quickgeocode_locationapi(&$obj, $op, $a3 = NULL, $a4 = NULL, $a5 = NULL) {
  switch ($op) {
    case 'fields':
      return array(
        'fake_dogeocodebutton' => t('QuickGeocode'),
      );
    case 'defaults':
      return array(
        'fake_dogeocodebutton' => array(
          'default' => 0,
          'collect' => 1,
        ),
      );
    case 'virtual fields':
      return array(
        'fake_dogeocodebutton' => t('QuickGeocode'),
      );
    case 'field_expand':
      if ($a3 == 'fake_dogeocodebutton') {
        drupal_add_js(drupal_get_path('module', 'location_quickgeocode') . '/location_quickgeocode.js');
        $widget = array(
          '#type' => 'item',
          '#title' => t('QuickGeocode'),
          '#value' => '<div class="location_quickgeocode">Javascript must be enabled to use QuickGeocode.</div>',
          '#attributes' => NULL,
          '#required' => $a4 == 2,
        );

        //gmap_widget_setup($element['locpick']['user_latitude'], 'locpick_latitude');
        return $widget;
      }
      break;
    case 'isunchanged':

      // ALWAYS unchanged.
      if ($a3 == 'fake_dogeocodebutton') {
        return TRUE;
      }
      break;
  }
}