You are here

function ip_geoloc_views_plugins in IP Geolocation Views & Maps 7

Implements hook_views_plugins().

3 Views style/format plugins and 1 contextual filter default argument plugin.

File

views/ip_geoloc.views.inc, line 301
ip_geoloc.views.inc

Code

function ip_geoloc_views_plugins() {
  $path = drupal_get_path('module', 'ip_geoloc');
  $plugins = array(
    'style' => array(
      'ip_geoloc_map' => array(
        'title' => t('Map (Google API, via IPGV&M)'),
        'help' => t('Displays the view as a Google map, using the Google API.'),
        'help topic' => 'style-ip-geoloc-map',
        'handler' => 'ip_geoloc_plugin_style_map',
        'path' => $path . '/views',
        // Uses ip-geoloc-map.tpl.php.
        'theme' => 'ip_geoloc_map',
        'theme path' => $path . '/views',
        'uses fields' => TRUE,
        // Map style and map options.
        'uses options' => TRUE,
        'uses grouping' => TRUE,
        'uses row plugin' => FALSE,
        'type' => 'normal',
        // May be overridden in ip_geoloc_plugin_style_map::render().
        'even empty' => TRUE,
      ),
    ),
  );
  $title_leaflet = t('Map (Leaflet API, via IPGV&M)');
  if (!module_exists('leaflet')) {
    $title_leaflet .= ' - ' . t('requires Leaflet');
  }
  $plugins['style']['ip_geoloc_leaflet'] = array(
    'title' => $title_leaflet,
    'help' => t('Displays the view as a map via the Leaflet API.'),
    'handler' => 'ip_geoloc_plugin_style_leaflet',
    'path' => $path . '/views',
    // Uses ip-geoloc-leaflet.tpl.php.
    'theme' => 'ip_geoloc_leaflet',
    'theme path' => $path . '/views',
    'uses fields' => TRUE,
    'uses options' => TRUE,
    'uses grouping' => TRUE,
    'uses row plugin' => FALSE,
    'type' => 'normal',
    // May be overridden in ip_geoloc_plugin_style_leaflet::render().
    'even empty' => TRUE,
  );
  if (module_exists('openlayers')) {
    $plugins['style']['ip_geoloc_openlayers'] = array(
      'title' => t('Map (OpenLayers API, via IPGV&M)'),
      'help' => t('Displays the view as a map via the OpenLayers API.'),
      'handler' => 'ip_geoloc_plugin_style_openlayers',
      'path' => $path . '/views',
      // Uses ip-geoloc-openlayers.tpl.php.
      'theme' => 'ip_geoloc_openlayers',
      'theme path' => $path . '/views',
      'uses fields' => TRUE,
      'uses options' => TRUE,
      'uses grouping' => TRUE,
      'uses row plugin' => FALSE,
      'type' => 'normal',
      // May be overridden in ip_geoloc_plugin_style_openlayers::render().
      'even empty' => TRUE,
    );
  }
  $plugins['argument default'] = array(
    'location_attribute' => array(
      'title' => t('Visitor location attribute (via IPGV&M)'),
      'handler' => 'ip_geoloc_plugin_argument_default_ip_geoloc',
      'path' => $path . '/views',
    ),
  );
  return $plugins;
}