You are here

ip_geoloc_theme.inc in IP Geolocation Views & Maps 8

Implements hook_theme().

Register the theme hooks available in this module, with their arguments. Does not apply to Views-specific themes and template files.

Themes may be invoked explicitly like so:

theme(array('<theme>'), $template_variables); // eg. <theme>==ip_geoloc_map

where $template_variables is an array indexed by template variable names:

$template_variables = array( 'locations' => $locations, 'div_id' => '...' );

The $template_variables are passed first to the corresponding template_preprocess_<theme> function where more variables may be added. Then it's on to the <theme>.tpl.php file for rendering!

File

ip_geoloc_theme.inc
View source
<?php

/**
 * @file
 * Implements hook_theme().
 *
 * Register the theme hooks available in this module, with their arguments.
 * Does not apply to Views-specific themes and template files.
 *
 * Themes may be invoked explicitly like so:
 *
 *  theme(array('<theme>'), $template_variables); // eg. <theme>==ip_geoloc_map
 *
 * where $template_variables is an array indexed by template variable names:
 *
 *  $template_variables = array(
 *    'locations' => $locations,
 *    'div_id' => '...'
 *  );
 *
 * The $template_variables are passed first to the corresponding
 * template_preprocess_<theme> function where more variables may be added.
 * Then it's on to the <theme>.tpl.php file for rendering!
 */

/**
 * Theming function.
 */
function ip_geoloc_theme($existing_themes, $type, $theme, $path) {
  $theme = [];
  $theme['ip_geoloc_visitor_map'] = [
    // Located at templates/ip_geoloc_map_multi_visitor.tpl.php.
    'template' => 'ip_geoloc_map_multi_visitor',
    'path' => $path . '/templates',
    'variables' => [
      'locations' => NULL,
      'div_id' => NULL,
      'map_options' => NULL,
      'map_style' => NULL,
    ],
  ];
  $theme['ip_geoloc_map_current_visitor'] = [
    // Located at templates/ip-geoloc-map-current-visitor.html.twig.
    // 'template' => 'ip_geoloc_map_current_visitor',.
    'path' => $path . '/templates',
    'variables' => [
      'ip_geoloc_settings' => [],
    ],
  ];
  $theme['ip_geoloc_map'] = [
    // Located at templates/ip-geoloc-map-current-visitor.html.twig.
    // 'template' => 'ip_geoloc_map_current_visitor',.
    'path' => $path . '/templates',
    'variables' => [
      'ip_geoloc_output_map_multi_location' => '',
    ],
  ];
  $theme['ip_geoloc_leaflet'] = [
    // Located at templates/ip-geoloc-map-current-visitor.html.twig.
    // 'template' => 'ip_geoloc_map_current_visitor',.
    'path' => $path . '/templates',
    'variables' => [
      'map_id' => '',
      'marker_set' => '',
      'style' => '',
    ],
  ];
  return $theme;
}

/**
 * Template preprocess function for the ip_geoloc_visitor_map theme.
 *
 * Preprocesses variables for theme/ip_geoloc_map_multi_visitor.tpl.php.
 */
function template_preprocess_ip_geoloc_visitor_map(&$variables) {
}

/**
 * Template preprocess function for the ip_geoloc_map_current_visitor theme.
 *
 * Preprocesses variables for theme/ip_geoloc_map_current_visitor.tpl.php.
 */
function template_preprocess_ip_geoloc_map_current_visitor(&$variables) {
}

Functions

Namesort descending Description
ip_geoloc_theme Theming function.
template_preprocess_ip_geoloc_map_current_visitor Template preprocess function for the ip_geoloc_map_current_visitor theme.
template_preprocess_ip_geoloc_visitor_map Template preprocess function for the ip_geoloc_visitor_map theme.