123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <?php
- /**
- * @file
- * Main OpenLayers Test Module file
- *
- * This file contains a test module to help with automated
- * testing.
- *
- * @ingroup openlayers
- */
- /**
- * Implements hook_menu().
- */
- function openlayers_test_menu() {
- $items = array();
- $items['admin/structure/openlayers/test'] = array(
- 'title' => 'Tests',
- 'description' => 'Test Pages for OpenLayers.',
- 'page callback' => 'openlayers_test_show_maps',
- 'access arguments' => array('administer openlayers'),
- 'file' => 'includes/openlayers_test.pages.inc',
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 9999,
- );
- $items['admin/structure/openlayers/test/list'] = array(
- 'title' => 'Show Maps',
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- 'weight' => -20,
- );
- $items['admin/structure/openlayers/test/js'] = array(
- 'title' => 'JS Tests',
- 'description' => 'Test Pages for OpenLayers Javascript.',
- 'page callback' => 'openlayers_test_js',
- 'access arguments' => array('administer openlayers'),
- 'file' => 'includes/openlayers_test.pages.inc',
- 'type' => MENU_LOCAL_TASK,
- 'weight' => -10,
- );
- return $items;
- }
- /**
- * Implements hook_ctools_plugin_api().
- */
- function openlayers_test_ctools_plugin_api($module, $api) {
- // Define plugins for OpenLayers plugins api
- if ($module == "openlayers") {
- switch ($api) {
- case 'openlayers_maps':
- return array('version' => 1);
- case 'openlayers_layers':
- return array('version' => 1);
- }
- }
- }
- /**
- * Implements hook_views_api().
- */
- function openlayers_test_views_api() {
- return array(
- 'api' => 2,
- );
- }
- /**
- * Implements hook_openlayers_maps().
- */
- function openlayers_test_openlayers_maps() {
- module_load_include('inc', 'openlayers_test', 'includes/openlayers_test.maps');
- return _openlayers_test_openlayers_maps();
- }
- /**
- * Implements hook_openlayers_layers().
- */
- function openlayers_test_openlayers_layers() {
- module_load_include('inc', 'openlayers_test', 'includes/openlayers_test.layers');
- return _openlayers_test_openlayers_layers();
- }
- /**
- * Implements hook_views_default_views().
- */
- function openlayers_test_views_default_views() {
- module_load_include('inc', 'openlayers_test', 'includes/openlayers_test.views');
- return _openlayers_test_views_default_views();
- }
- /**
- * Impements hook_openlayers_map_preprocess_alter().
- */
- function openlayers_test_openlayers_map_preprocess_alter(&$map) {
- // For testing purposes, display a message on the only the Test
- // page, and only once.
- static $performed = FALSE;
- if (!$performed && $_GET['q'] == 'admin/structure/openlayers/test') {
- drupal_set_message(t('OpenLayers preprocess map alter hook fired.'));
- $performed = TRUE;
- }
- // Add stop render for JS testing
- if ($_GET['q'] == 'admin/structure/openlayers/test/js') {
- $map['stop_render'] = TRUE;
- }
- }
- /**
- * Impements hook_openlayers_map_alter().
- */
- function openlayers_test_openlayers_map_alter(&$map) {
- // For testing purposes, display a message on the only the Test
- // page, and only once.
- static $performed = FALSE;
- if (!$performed && $_GET['q'] == 'admin/structure/openlayers/test') {
- drupal_set_message(t('OpenLayers map alter hook fired.'));
- $performed = TRUE;
- }
- }
|