Remove Openlayers modules, patches, dependencies, configuration, and related code.

This commit is contained in:
Michael Stenta 2020-02-07 13:57:13 -05:00
parent 9f6bbb8253
commit b1a961ae86
41 changed files with 9 additions and 1573 deletions

View File

@ -98,31 +98,6 @@ projects[multiupload_imagefield_widget][version] = "1.3"
projects[navbar][subdir] = "contrib"
projects[navbar][version] = "1.7"
projects[openlayers][subdir] = "contrib"
projects[openlayers][download][type] = "git"
projects[openlayers][download][url] = "https://git.drupal.org/project/openlayers.git"
projects[openlayers][download][branch] = "7.x-3.x"
projects[openlayers][download][revision] = "569e90ca74ea1862c9ecfbc16836242e205de778"
; Move Elements dependency to Openlayers Examples.
projects[openlayers][patch][] = "http://www.drupal.org/files/issues/openlayers_examples_elements_dependency-2620098-2.patch"
; Switch to ROADMAP when zoomed further than Google's max zoom level.
projects[openlayers][patch][] = "http://www.drupal.org/files/issues/openlayers_gmap_zoom_switch_type-2680273-1.patch"
; Add a jQuery trigger event when popups are displayed.
projects[openlayers][patch][] = "http://www.drupal.org/files/issues/openlayers_popup_trigger-2687781-1.patch"
; Issue #2644580: Maps with Google layers break when loaded in invisible element
projects[openlayers][patch][] = "http://www.drupal.org/files/issues/openlayers_googlemaps_refresh-2644580-19.patch"
; Issue #2911611: Update ZoomToSource Component: use new view.animate() method.
projects[openlayers][patch][] = "http://www.drupal.org/files/issues/openlayers_ol4_zoomtosource-2911611-4.patch"
; Issue #2946213: Google maps do not support fractional zoom
projects[openlayers][patch][] = "http://www.drupal.org/files/issues/openlayers_googlemaps_fractional_zoom-2946213-2.patch"
; Issue #3006751: PHP 7 support
projects[openlayers][patch][] = "http://www.drupal.org/files/issues/2018-10-30/openlayers-2952602-6-php-72.patch"
; Remove base layer assignment code.
projects[openlayers][patch][] = "http://www.drupal.org/files/issues/2018-11-01/openlayers_base_layer_mechanism-2543130-12.patch"
projects[openlayers_geolocate_button][subdir] = "contrib"
projects[openlayers_geolocate_button][version] = "3.2"
projects[pathauto][subdir] = "contrib"
projects[pathauto][version] = "1.3"
; Fix SQLite3 issue.
@ -131,9 +106,6 @@ projects[pathauto][patch][] = "http://www.drupal.org/files/issues/2582655-path-p
projects[pathauto_entity][subdir] = "contrib"
projects[pathauto_entity][version] = "1.0"
projects[registry_autoload][subdir] = "contrib"
projects[registry_autoload][version] = "1.3"
projects[restws][subdir] = "contrib"
projects[restws][version] = "2.8"
; Add ability to filter by entity bundle.
@ -151,9 +123,6 @@ projects[restws_file][version] = "1.3"
; Fix Issue #3019850: Notice: Trying to get property of non-object in restws_file_restws_request_alter() (line 30 of restws_file.module).
projects[restws_file][patch][] = "http://www.drupal.org/files/issues/2019-10-26/restws_file-bundlenotice-3019850-3.patch"
projects[service_container][subdir] = "contrib"
projects[service_container][version] = "1.0-beta5"
projects[strongarm][subdir] = "contrib"
projects[strongarm][version] = "2.0"
@ -209,8 +178,5 @@ libraries[farmOS-map][download][url] = "http://github.com/farmOS/farmOS-map/rele
libraries[modernizr][download][type] = "get"
libraries[modernizr][download][url] = "http://github.com/Modernizr/Modernizr/archive/v2.8.3.zip"
libraries[openlayers3][download][type] = "get"
libraries[openlayers3][download][url] = "http://github.com/openlayers/openlayers/releases/download/v4.6.4/v4.6.4.zip"
libraries[underscore][download][type] = "get"
libraries[underscore][download][url] = "http://github.com/jashkenas/underscore/archive/1.9.1.zip"

View File

@ -71,9 +71,6 @@ function farm_install() {
// Use the farm menu for primary links (provided by farm_admin).
variable_set('menu_main_links_source', 'farm');
// Set the Openlayers library variant to local.
\Drupal\openlayers\Config::set('openlayers.variant', 'local:4.6.4');
}
/**
@ -286,7 +283,7 @@ function farm_update_7001(&$sandbox) {
// Enable new module dependencies.
$modules = array(
'openlayers_geofield',
// 'openlayers_geofield', // Removed.
'views_geojson',
);
_farm_update_enable_modules($modules);
@ -322,12 +319,7 @@ function farm_update_7004(&$sandbox) {
* Load Openlayers via CDN.
*/
function farm_update_7005(&$sandbox) {
// Enable the Libraries CDN module.
_farm_update_enable_modules(array('libraries_cdn'));
// Load Openlayers 3.8.2 from JSDelivr CDN.
\Drupal\openlayers\Config::set('openlayers.variant', 'jsdelivr:ol3:3.8.2');
// Removed.
}
/**
@ -469,14 +461,14 @@ function farm_update_7010(&$sandbox) {
* Load Openlayers 3.10.1 from CDNJS.
*/
function farm_update_7011(&$sandbox) {
\Drupal\openlayers\Config::set('openlayers.variant', 'cdnjs:ol3:3.10.1');
// Removed.
}
/**
* Load Openlayers 3.11.2 from CDNJS.
*/
function farm_update_7012(&$sandbox) {
\Drupal\openlayers\Config::set('openlayers.variant', 'cdnjs:ol3:3.11.2');
// Removed.
}
/**
@ -656,7 +648,7 @@ function farm_update_7027(&$sandbox) {
* Update Openlayers JS library to 4.3.3.
*/
function farm_update_7028(&$sandbox) {
\Drupal\openlayers\Config::set('openlayers.variant', 'cdnjs:ol3:4.3.3');
// Removed.
}
/**
@ -744,7 +736,7 @@ function farm_update_7037(&$sandbox) {
* Update Openlayers JS library to 4.6.4.
*/
function farm_update_7038(&$sandbox) {
\Drupal\openlayers\Config::set('openlayers.variant', 'cdnjs:ol3:4.6.4');
// Removed.
}
/**
@ -795,7 +787,7 @@ function farm_update_7044(&$sandbox) {
function farm_update_7045(&$sandbox) {
// Set the variant config in the Openlayers module.
\Drupal\openlayers\Config::set('openlayers.variant', 'local:4.6.4');
// Removed.
// Uninstall Libraries CDN.
db_query("DELETE FROM {system} WHERE name = 'libraries_cdn' AND type = 'module'");

View File

@ -1,73 +0,0 @@
<?php
/**
* @file
* farm_area.default_openlayers_components.inc
*/
/**
* Implements hook_default_openlayers_components().
*/
function farm_area_default_openlayers_components() {
$export = array();
// Get farm area types.
$area_types = farm_area_types();
// Create an array of area type source and layer names.
$area_type_sources = array();
$area_type_layers = array();
foreach ($area_types as $type => $info) {
$layer = 'farm_area_layer_' . $type;
$area_type_layers[$layer] = $layer;
$source = 'farm_area_source_' . $type;
$area_type_sources[$source] = $source;
}
// Define an area details popup component that applies to all area type layers.
$ol_component = new stdClass();
$ol_component->disabled = FALSE; /* Edit this to true to make a default ol_component disabled initially */
$ol_component->api_version = 1;
$ol_component->machine_name = 'farm_area_component_area_details_popup';
$ol_component->name = 'Farm Area: Area Details Popup';
$ol_component->description = '';
$ol_component->factory_service = 'openlayers.Component:Popup';
$ol_component->options = array(
'frontend_layers' => $area_type_layers,
'positioning' => 'top-center',
'autoPan' => 1,
'autoPanAnimation' => '0',
'autoPanMargin' => '20',
'closer' => 1,
);
$export['farm_area_component_area_details_popup'] = $ol_component;
// Define a zoom-to-source component that applies to all area sources.
$ol_component = new stdClass();
$ol_component->disabled = FALSE; /* Edit this to true to make a default ol_component disabled initially */
$ol_component->api_version = 1;
$ol_component->machine_name = 'farm_area_component_areas_zoom_to_source';
$ol_component->name = 'Farm Area: Areas Zoom to Source';
$ol_component->description = 'Automatically zoom to the areas source when the map is first built.';
$ol_component->factory_service = 'openlayers.Component:ZoomToSource';
$ol_component->options = array(
'source' => $area_type_sources,
'duration' => 500,
'zoom' => 'auto',
'max_zoom' => 20,
'process_once' => 0,
);
$export['farm_area_component_areas_zoom_to_source'] = $ol_component;
return $export;
}
/**
* Implements hook_default_openlayers_components_alter().
*/
function farm_area_default_openlayers_components_alter(&$components) {
// Add the Farm Areas source to the Geofield Zoom-To-Source component.
if (!empty($components['farm_map_component_geofield_zoom_to_source'])) {
$components['farm_map_component_geofield_zoom_to_source']->options['source']['views_geojson_farm_areas_geojson_feed'] = 'views_geojson_farm_areas_geojson_feed';
}
}

View File

@ -1,104 +0,0 @@
<?php
/**
* @file
* farm_area.default_openlayers_layers.inc
*/
/**
* Implements hook_default_openlayers_layers().
*/
function farm_area_default_openlayers_layers() {
$export = array();
// Load all available area types.
$area_types = farm_area_types();
// Start an array of layer names.
$layer_names = array();
// Iterate through the available types, and add a layer for each one.
foreach ($area_types as $key => $type) {
// Generate a machine name.
$layer_name = 'farm_area_layer_' . $key;
// Add the machine name to the array for later.
$layer_names[] = $layer_name;
// If zoom levels were defined, convert them to the correct format.
$zoomActivity = '';
if (!empty($type['zoom_levels'])) {
$zoomActivity = implode("\n", $type['zoom_levels']);
}
// Define the layer.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = $layer_name;
$ol_layer->name = $type['label'];
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Vector';
$ol_layer->options = array(
'source' => 'farm_area_source_' . $key,
'visible' => 1,
'zoomActivity' => $zoomActivity,
'style' => $type['style'],
);
// Add the source to the export.
$export[$layer_name] = $ol_layer;
}
// Define a layer group for individual area type layers.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_area_layer_group';
$ol_layer->name = 'Farm Area Layer Group';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Group';
$ol_layer->options = array(
'source' => '',
'visible' => 1,
'grouptitle' => 'Area layers',
'grouplayers' => $layer_names,
);
$export['farm_area_layer_group'] = $ol_layer;
// Define a layer containing all farm areas, regardless of type.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_area_layer_areas';
$ol_layer->name = 'Farm Areas';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Vector';
$ol_layer->options = array(
'source' => 'views_geojson_farm_areas_geojson_feed',
'visible' => 1,
'zoomActivity' => '',
'style' => 'farm_map_style_grey',
);
$export['farm_area_layer_areas'] = $ol_layer;
// Define a layer group for the "all areas" layer.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_area_layer_areas_group';
$ol_layer->name = 'Farm Area Layer Group (all areas)';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Group';
$ol_layer->options = array(
'source' => '',
'visible' => 1,
'grouptitle' => 'Areas layer',
'grouplayers' => array(
'farm_area_layer_areas',
),
);
$export['farm_area_layer_areas_group'] = $ol_layer;
return $export;
}

View File

@ -1,77 +0,0 @@
<?php
/**
* @file
* farm_area.default_openlayers_maps.inc
*/
/**
* Implements hook_default_openlayers_maps().
*/
function farm_area_default_openlayers_maps() {
$export = array();
$ol_map = new stdClass();
$ol_map->disabled = FALSE; /* Edit this to true to make a default ol_map disabled initially */
$ol_map->api_version = 1;
$ol_map->machine_name = 'farm_areas';
$ol_map->name = 'Farm Areas';
$ol_map->description = 'A map of all farm areas, color-coded by type.';
$ol_map->factory_service = 'openlayers.Map:OLMap';
$ol_map->options = array(
'width' => 'auto',
'height' => '500px',
'view' => array(
'center' => array(
'lat' => 0,
'lon' => 0,
),
'rotation' => 0,
'zoom' => 2,
'minZoom' => 0,
'maxZoom' => 24,
),
'renderer' => 'canvas',
'layers' => array(
0 => 'farm_area_layer_group',
),
'controls' => array(
0 => 'openlayers_control_zoom',
1 => 'openlayers_control_scaleline',
2 => 'farm_map_control_layer_switcher',
3 => 'farm_map_control_geolocate',
4 => 'farm_map_control_geocoder',
/**
* @todo
* https://www.drupal.org/node/2543186
*/
// 5 => 'openlayers_control_fullscreen',
),
'components' => array(
0 => 'farm_area_component_areas_zoom_to_source',
1 => 'farm_area_component_area_details_popup',
2 => 'farm_map_component_progress_bar',
),
'interactions' => array(
0 => 'openlayers_interaction_doubleclickzoom',
1 => 'openlayers_interaction_dragpan',
2 => 'openlayers_interaction_mousewheelzoom',
3 => 'openlayers_interaction_pinchzoom',
),
);
$export['farm_areas'] = $ol_map;
return $export;
}
/**
* Implements hook_default_openlayers_maps_alter().
*/
function farm_area_default_openlayers_maps_alter(&$maps) {
// Add "all areas" group layer to farm_geofield* maps.
foreach ($maps as &$map) {
if (substr($map->machine_name, 0, 17) == 'farm_map_geofield') {
$map->options['layers'][] = 'farm_area_layer_areas_group';
}
}
}

View File

@ -1,44 +0,0 @@
<?php
/**
* @file
* farm_area.default_openlayers_sources.inc
*/
/**
* Implements hook_default_openlayers_sources().
*/
function farm_area_default_openlayers_sources() {
$export = array();
// Load all available area types.
$area_types = farm_area_types();
// Iterate through the available types, and add a source for each one.
foreach ($area_types as $key => $type) {
// Generate a machine name.
$machine_name = 'farm_area_source_' . $key;
// Build the source.
$ol_source = new stdClass();
$ol_source->disabled = FALSE; /* Edit this to true to make a default ol_source disabled initially */
$ol_source->api_version = 1;
$ol_source->machine_name = $machine_name;
$ol_source->name = 'Farm Area: ' . $type['label'];
$ol_source->description = 'This source is automatically generated by the Farm Area module.';
$ol_source->factory_service = 'openlayers.Source:GeoJSON';
$ol_source->options = array(
'url' => 'farm/areas/geojson/' . $key,
'useBBOX' => 0,
'paramForwarding' => 1,
'reloadOnZoomChange' => 0,
'reloadOnExtentChange' => 0,
'geojson_data' => '',
);
// Add the source to the export.
$export[$machine_name] = $ol_source;
}
return $export;
}

View File

@ -11,18 +11,6 @@ function farm_area_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "field_group" && $api == "field_group") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_components") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_layers") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_maps") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_sources") {
return array("version" => "1");
}
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}

View File

@ -19,8 +19,6 @@ dependencies[] = image
dependencies[] = list
dependencies[] = multiupload_filefield_widget
dependencies[] = multiupload_imagefield_widget
dependencies[] = openlayers
dependencies[] = openlayers_geofield
dependencies[] = options
dependencies[] = pathauto
dependencies[] = strongarm
@ -29,8 +27,6 @@ dependencies[] = views
dependencies[] = views_geojson
dependencies[] = views_tree
features[ctools][] = field_group:field_group:1
features[ctools][] = openlayers:default_openlayers_components:1
features[ctools][] = openlayers:default_openlayers_maps:1
features[ctools][] = strongarm:strongarm:1
features[ctools][] = views:views_default:3.0
features[features_api][] = api:2
@ -45,9 +41,6 @@ features[field_instance][] = taxonomy_term-farm_areas-field_farm_files
features[field_instance][] = taxonomy_term-farm_areas-field_farm_flags
features[field_instance][] = taxonomy_term-farm_areas-field_farm_geofield
features[field_instance][] = taxonomy_term-farm_areas-field_farm_images
features[openlayers_components][] = farm_area_component_area_details_popup
features[openlayers_components][] = farm_area_component_areas_zoom_to_source
features[openlayers_maps][] = farm_areas
features[taxonomy][] = farm_areas
features[variable][] = pathauto_taxonomy_term_farm_areas_pattern
features[views_view][] = farm_areas

View File

@ -245,36 +245,6 @@ function farm_area_details_json($aid) {
drupal_exit();
}
/**
* Implements hook_openlayers_object_preprocess_alter().
*/
function farm_area_openlayers_object_preprocess_alter(&$build, $context) {
// If the object is not a Map, bail.
if (!$context instanceof Drupal\openlayers\Types\MapInterface) {
return;
}
// If this is the farm_areas map, add area details javascript.
if ($context->getMachineName() == 'farm_areas') {
// Add a Javascript setting that defines the base path of the site.
// We do this instead of using Drupal.settings.basePath in Javascript
// because that variable does not take into account whether or not clean
// URLs are enabled.
$setting = array(
'farm_area' => array(
'base_path' => url('farm/area'),
),
);
drupal_add_js($setting, 'setting');
// Add the Javascript for lazy loading area details.
$path = drupal_get_path('module', 'farm_area');
drupal_add_js($path . '/js/farm_area.openlayers.popup.js');
}
}
/**
* Implements hook_page_build().
*/

View File

@ -1,22 +0,0 @@
(function ($) {
Drupal.behaviors.farm_area_details = {
attach: function (context, settings) {
// When an Openlayers popup is displayed, load area details.
$(document).on('openlayers.Component:Popup', function (event, options) {
// Load the area details.
var area_details = jQuery('.ol-popup-description .area-details');
var area_id = area_details.attr('id').replace('area-details-', '');
if (area_id) {
jQuery.getJSON(Drupal.settings.farm_area.base_path + '/' + area_id + '/details', function(data) {
if (data) {
area_details.html(data);
options.overlay.setPosition(options.evt.coordinate);
}
});
}
});
}
};
}(jQuery));

View File

@ -35,7 +35,6 @@ dependencies[] = log
dependencies[] = multiupload_filefield_widget
dependencies[] = multiupload_imagefield_widget
dependencies[] = number
dependencies[] = openlayers
dependencies[] = options
dependencies[] = pathauto
dependencies[] = strongarm

View File

@ -29,7 +29,6 @@ dependencies[] = list
dependencies[] = log
dependencies[] = multiupload_filefield_widget
dependencies[] = multiupload_imagefield_widget
dependencies[] = openlayers_geofield
dependencies[] = options
dependencies[] = pathauto
dependencies[] = strongarm

View File

@ -32,7 +32,6 @@ dependencies[] = list
dependencies[] = log
dependencies[] = multiupload_filefield_widget
dependencies[] = multiupload_imagefield_widget
dependencies[] = openlayers_geofield
dependencies[] = options
dependencies[] = pathauto
dependencies[] = strongarm

View File

@ -34,7 +34,6 @@ dependencies[] = list
dependencies[] = log
dependencies[] = multiupload_filefield_widget
dependencies[] = multiupload_imagefield_widget
dependencies[] = openlayers_geofield
dependencies[] = options
dependencies[] = taxonomy
dependencies[] = text

View File

@ -33,7 +33,6 @@ dependencies[] = list
dependencies[] = log
dependencies[] = multiupload_filefield_widget
dependencies[] = multiupload_imagefield_widget
dependencies[] = openlayers_geofield
dependencies[] = options
dependencies[] = taxonomy
dependencies[] = text

View File

@ -33,7 +33,6 @@ dependencies[] = list
dependencies[] = log
dependencies[] = multiupload_filefield_widget
dependencies[] = multiupload_imagefield_widget
dependencies[] = openlayers_geofield
dependencies[] = options
dependencies[] = pathauto
dependencies[] = strongarm

View File

@ -34,7 +34,6 @@ dependencies[] = list
dependencies[] = log
dependencies[] = multiupload_filefield_widget
dependencies[] = multiupload_imagefield_widget
dependencies[] = openlayers_geofield
dependencies[] = options
dependencies[] = taxonomy
dependencies[] = text

View File

@ -1,14 +1,3 @@
.farm-map {
height: 400px;
}
.ol-popup-content {
width: 300px;
}
.ol-popup-content .ol-popup-name {
font-size: 20px;
}
.ol-popup-content .ol-popup-description {
max-height: 200px;
overflow: auto;
}

View File

@ -1,66 +0,0 @@
<?php
/**
* @file
* farm_map.default_openlayers_components.inc
*/
/**
* Implements hook_default_openlayers_components().
*/
function farm_map_default_openlayers_components() {
$export = array();
$ol_component = new stdClass();
$ol_component->disabled = FALSE; /* Edit this to true to make a default ol_component disabled initially */
$ol_component->api_version = 1;
$ol_component->machine_name = 'farm_map_component_geofield_widget';
$ol_component->name = 'Farm Map: Geofield widget component';
$ol_component->description = '';
$ol_component->factory_service = 'openlayers.Component:GeofieldWidget';
$ol_component->options = array(
'featureLimit' => 0,
'showInputField' => 1,
'inputFieldName' => 'geom',
'dataProjection' => 'EPSG:4326',
'editStyle' => 'openlayers_geofield_style_edit',
'editLayer' => 'openlayers_geofield_layer_widget',
'editControl' => 'farm_map_control_geofield',
'dataType' => array(
'WKT' => 'WKT',
'GeoJSON' => 0,
'KML' => 0,
'GPX' => 0,
),
);
$export['farm_map_component_geofield_widget'] = $ol_component;
$ol_component = new stdClass();
$ol_component->disabled = FALSE; /* Edit this to true to make a default ol_component disabled initially */
$ol_component->api_version = 1;
$ol_component->machine_name = 'farm_map_component_geofield_zoom_to_source';
$ol_component->name = 'Farm Map: Geofield Zoom to Source';
$ol_component->description = 'Automatically zoom to a geofield source when the map is first built.';
$ol_component->factory_service = 'openlayers.Component:ZoomToSource';
$ol_component->options = array(
'source' => array(
'openlayers_geofield_source_vector' => 'openlayers_geofield_source_vector',
),
'duration' => 500,
'zoom' => 'auto',
'max_zoom' => 20,
'process_once' => 1,
);
$export['farm_map_component_geofield_zoom_to_source'] = $ol_component;
$ol_component = new stdClass();
$ol_component->disabled = FALSE; /* Edit this to true to make a default ol_component disabled initially */
$ol_component->api_version = 1;
$ol_component->machine_name = 'farm_map_component_progress_bar';
$ol_component->name = 'Farm Map: Progress Bar';
$ol_component->description = '';
$ol_component->factory_service = 'openlayers.Component:ProgressBar';
$ol_component->options = array();
$export['farm_map_component_progress_bar'] = $ol_component;
return $export;
}

View File

@ -1,79 +0,0 @@
<?php
/**
* @file
* farm_map.default_openlayers_controls.inc
*/
/**
* Implements hook_default_openlayers_controls().
*/
function farm_map_default_openlayers_controls() {
$export = array();
$ol_control = new stdClass();
$ol_control->disabled = FALSE; /* Edit this to true to make a default ol_control disabled initially */
$ol_control->api_version = 1;
$ol_control->machine_name = 'farm_map_control_geocoder';
$ol_control->name = 'Farm Map: Geocoder';
$ol_control->description = '';
$ol_control->factory_service = 'openlayers.Control:OLGeocoder';
$ol_control->options = array();
$export['farm_map_control_geocoder'] = $ol_control;
$ol_control = new stdClass();
$ol_control->disabled = FALSE; /* Edit this to true to make a default ol_control disabled initially */
$ol_control->api_version = 1;
$ol_control->machine_name = 'farm_map_control_geofield';
$ol_control->name = 'Farm Map: Geofield toolbar';
$ol_control->description = '';
$ol_control->factory_service = 'openlayers.Control:Geofield';
$ol_control->options = array(
'draw' => array(
'Point' => 'Point',
'LineString' => 'LineString',
'Polygon' => 'Polygon',
'Circle' => 'Circle',
'MultiPoint' => 0,
'MultiLineString' => 0,
'MultiPolygon' => 0,
'Triangle' => 0,
'Square' => 0,
'Box' => 0,
),
'actions' => array(
'Edit' => 'Edit',
'Move' => 'Move',
'Clear' => 'Clear',
),
'options' => array(
'Snap' => 0,
),
);
$export['farm_map_control_geofield'] = $ol_control;
$ol_control = new stdClass();
$ol_control->disabled = FALSE; /* Edit this to true to make a default ol_control disabled initially */
$ol_control->api_version = 1;
$ol_control->machine_name = 'farm_map_control_geolocate';
$ol_control->name = 'Farm Map: Geolocate';
$ol_control->description = '';
$ol_control->factory_service = 'openlayers.Control:Geolocate';
$ol_control->options = array(
'zoom' => 18,
);
$export['farm_map_control_geolocate'] = $ol_control;
$ol_control = new stdClass();
$ol_control->disabled = FALSE; /* Edit this to true to make a default ol_control disabled initially */
$ol_control->api_version = 1;
$ol_control->machine_name = 'farm_map_control_layer_switcher';
$ol_control->name = 'Farm Map: Layer Switcher';
$ol_control->description = '';
$ol_control->factory_service = 'openlayers.Control:OL3LayerSwitcher';
$ol_control->options = array(
'collapsible' => 0,
);
$export['farm_map_control_layer_switcher'] = $ol_control;
return $export;
}

View File

@ -1,18 +0,0 @@
<?php
/**
* @file
* farm_map.default_openlayers_interactions.inc
*/
/**
* Implements hook_default_openlayers_interactions_alter().
*/
function farm_map_default_openlayers_interactions_alter(&$interactions) {
// If the default dragpan interaction exists alter it.
if (!empty($interactions['openlayers_interaction_dragpan'])) {
// Set the delay to zero.
$interactions['openlayers_interaction_dragpan']->options['delay'] = 0;
}
}

View File

@ -1,167 +0,0 @@
<?php
/**
* @file
* farm_map.default_openlayers_layers.inc
*/
/**
* Implements hook_default_openlayers_layers().
*/
function farm_map_default_openlayers_layers() {
$export = array();
// Google Hybrid layer.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_map_layer_google_hybrid';
$ol_layer->name = 'Google Hybrid';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Tile';
$ol_layer->options = array(
'source' => 'farm_map_source_google_hybrid',
'visible' => 1,
'opacity' => 1,
/**
* @todo
* https://www.drupal.org/node/2543130
*/
'type' => 'base',
);
$export['farm_map_layer_google_hybrid'] = $ol_layer;
// Google Satellite layer.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_map_layer_google_satellite';
$ol_layer->name = 'Google Satellite';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Tile';
$ol_layer->options = array(
'source' => 'farm_map_source_google_satellite',
'visible' => 1,
'opacity' => 1,
/**
* @todo
* https://www.drupal.org/node/2543130
*/
'type' => 'base',
);
$export['farm_map_layer_google_satellite'] = $ol_layer;
// Google Terrain layer.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_map_layer_google_terrain';
$ol_layer->name = 'Google Terrain';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Tile';
$ol_layer->options = array(
'source' => 'farm_map_source_google_terrain',
'visible' => 1,
'opacity' => 1,
/**
* @todo
* https://www.drupal.org/node/2543130
*/
'type' => 'base',
);
$export['farm_map_layer_google_terrain'] = $ol_layer;
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_map_layer_openstreetmap';
$ol_layer->name = 'OpenStreetMap';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Tile';
$ol_layer->options = array(
'source' => 'farm_map_source_openstreetmap',
'visible' => 1,
/**
* @todo
* https://www.drupal.org/node/2543130
*/
'type' => 'base',
);
$export['farm_map_layer_openstreetmap'] = $ol_layer;
// Base layer group.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_map_layer_group';
$ol_layer->name = 'Farm Map Layer Group';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Group';
$ol_layer->options = array(
'source' => '',
'visible' => 1,
'grouptitle' => 'Base layers',
'grouplayers' => array(
0 => 'farm_map_layer_google_hybrid',
1 => 'farm_map_layer_openstreetmap',
/**
* @todo
* https://www.drupal.org/node/2543188
*/
// 2 => 'farm_map_layer_google_satellite',
// 3 => 'farm_map_layer_google_terrain',
),
);
$export['farm_map_layer_group'] = $ol_layer;
// Geofield widget layer group.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_map_geofield_widget_layer_group';
$ol_layer->name = 'Farm Map Geofield Widget Layer Group';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Group';
$ol_layer->options = array(
'source' => '',
'visible' => 1,
'grouptitle' => 'Draw',
'grouplayers' => array(
'openlayers_geofield_layer_widget',
),
);
$export['farm_map_geofield_widget_layer_group'] = $ol_layer;
// Geofield formatter layer group.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = 'farm_map_geofield_formatter_layer_group';
$ol_layer->name = 'Farm Map Geofield Formatter Layer Group';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Group';
$ol_layer->options = array(
'source' => '',
'visible' => 1,
'grouptitle' => 'Geometry',
'grouplayers' => array(
'openlayers_geofield_layer_formatter',
),
);
$export['farm_map_geofield_formatter_layer_group'] = $ol_layer;
return $export;
}
/**
* Implements hook_default_openlayers_layers_alter().
*/
function farm_map_default_openlayers_layers_alter(&$layers) {
// Override the styles of the Geofield Widget and Formatter layers.
if (!empty($layers['openlayers_geofield_layer_widget'])) {
$layers['openlayers_geofield_layer_widget']->options['style'] = 'farm_map_style_geofield';
}
if (!empty($layers['openlayers_geofield_layer_formatter'])) {
$layers['openlayers_geofield_layer_formatter']->options['style'] = 'farm_map_style_geofield';
}
}

View File

@ -1,139 +0,0 @@
<?php
/**
* @file
* farm_map.default_openlayers_maps.inc
*/
/**
* Implements hook_default_openlayers_maps().
*/
function farm_map_default_openlayers_maps() {
$export = array();
$ol_map = new stdClass();
$ol_map->disabled = FALSE; /* Edit this to true to make a default ol_map disabled initially */
$ol_map->api_version = 1;
$ol_map->machine_name = 'farm_map_geofield';
$ol_map->name = 'Farm Map: Geofield Widget';
$ol_map->description = 'Farm map for use in Geofield widgets.';
$ol_map->factory_service = 'openlayers.Map:OLMap';
$ol_map->options = array(
'width' => 'auto',
'height' => '500px',
'view' => array(
'center' => array(
'lat' => 0,
'lon' => 0,
),
'rotation' => 0,
'zoom' => 2,
'minZoom' => 0,
'maxZoom' => 24,
),
'layers' => array(
0 => 'farm_map_geofield_widget_layer_group',
),
'controls' => array(
0 => 'openlayers_control_zoom',
1 => 'openlayers_control_scaleline',
2 => 'farm_map_control_layer_switcher',
3 => 'farm_map_control_geolocate',
4 => 'farm_map_control_geocoder',
/**
* @todo
* https://www.drupal.org/node/2543186
*/
// 5 => 'openlayers_control_fullscreen',
),
'interactions' => array(
0 => 'openlayers_interaction_doubleclickzoom',
1 => 'openlayers_interaction_dragpan',
2 => 'openlayers_interaction_mousewheelzoom',
3 => 'openlayers_interaction_pinchzoom',
),
'components' => array(
0 => 'farm_map_component_geofield_widget',
1 => 'farm_map_component_geofield_zoom_to_source',
2 => 'farm_map_component_progress_bar',
),
'renderer' => 'canvas',
);
$export['farm_map_geofield'] = $ol_map;
$ol_map = new stdClass();
$ol_map->disabled = FALSE; /* Edit this to true to make a default ol_map disabled initially */
$ol_map->api_version = 1;
$ol_map->machine_name = 'farm_map_geofield_formatter';
$ol_map->name = 'Farm Map: Geofield Formatter';
$ol_map->description = 'Farm map for use in Geofield formatters.';
$ol_map->factory_service = 'openlayers.Map:OLMap';
$ol_map->options = array(
'width' => 'auto',
'height' => '500px',
'view' => array(
'center' => array(
'lat' => 0,
'lon' => 0,
),
'rotation' => 0,
'zoom' => 2,
'minZoom' => 0,
'maxZoom' => 24,
),
'layers' => array(
0 => 'farm_map_geofield_formatter_layer_group',
),
'controls' => array(
0 => 'openlayers_control_zoom',
1 => 'openlayers_control_scaleline',
2 => 'farm_map_control_layer_switcher',
3 => 'farm_map_control_geocoder',
/**
* @todo
* https://www.drupal.org/node/2543186
*/
// 4 => 'openlayers_control_fullscreen',
),
'interactions' => array(
0 => 'openlayers_interaction_doubleclickzoom',
1 => 'openlayers_interaction_dragpan',
2 => 'openlayers_interaction_mousewheelzoom',
3 => 'openlayers_interaction_pinchzoom',
),
'components' => array(
0 => 'farm_map_component_geofield_zoom_to_source',
1 => 'farm_map_component_progress_bar',
),
'renderer' => 'canvas',
);
$export['farm_map_geofield_formatter'] = $ol_map;
return $export;
}
/**
* Implements hook_default_openlayers_maps_alter().
*/
function farm_map_default_openlayers_maps_alter(&$maps) {
// This module implements hook_module_implements_alter() to ensure that this
// function always runs last, so we can ensure that any modifications made
// below will take priority over any other implementations of this hook.
// @see farm_map_module_implements_alter()
// Iterate through all maps.
foreach ($maps as &$map) {
// Only alter maps that have a farm_* namespace.
if (substr($map->machine_name, 0, 5) == 'farm_') {
// Add "base layers" group layer to the end all maps.
$map->options['layers'][] = 'farm_map_layer_group';
// Reverse the order of layers.
// This is necessary because of the following Openlayers module commit:
// http://cgit.drupalcode.org/openlayers/commit/?id=321aee3
$map->options['layers'] = array_reverse($map->options['layers']);
}
}
}

View File

@ -1,72 +0,0 @@
<?php
/**
* @file
* farm_map.default_openlayers_sources.inc
*/
/**
* Implements hook_default_openlayers_sources().
*/
function farm_map_default_openlayers_sources() {
$export = array();
$ol_source = new stdClass();
$ol_source->disabled = FALSE; /* Edit this to true to make a default ol_source disabled initially */
$ol_source->api_version = 1;
$ol_source->machine_name = 'farm_map_source_google_hybrid';
$ol_source->name = 'Farm Map: Google Hybrid';
$ol_source->description = '';
$ol_source->factory_service = 'openlayers.Source:GoogleMaps';
$ol_source->options = array(
'key' => variable_get('farm_map_google_api_key', ''),
'client' => '',
'channel' => '',
'mapTypeId' => 'HYBRID',
'sensor' => 0,
);
$export['farm_map_source_google_hybrid'] = $ol_source;
$ol_source = new stdClass();
$ol_source->disabled = FALSE; /* Edit this to true to make a default ol_source disabled initially */
$ol_source->api_version = 1;
$ol_source->machine_name = 'farm_map_source_google_satellite';
$ol_source->name = 'Farm Map: Google Satellite';
$ol_source->description = '';
$ol_source->factory_service = 'openlayers.Source:GoogleMaps';
$ol_source->options = array(
'key' => variable_get('farm_map_google_api_key', ''),
'client' => '',
'channel' => '',
'mapTypeId' => 'SATELLITE',
'sensor' => 0,
);
$export['farm_map_source_google_satellite'] = $ol_source;
$ol_source = new stdClass();
$ol_source->disabled = FALSE; /* Edit this to true to make a default ol_source disabled initially */
$ol_source->api_version = 1;
$ol_source->machine_name = 'farm_map_source_google_terrain';
$ol_source->name = 'Farm Map: Google Terrain';
$ol_source->description = '';
$ol_source->factory_service = 'openlayers.Source:GoogleMaps';
$ol_source->options = array(
'key' => variable_get('farm_map_google_api_key', ''),
'client' => '',
'channel' => '',
'mapTypeId' => 'TERRAIN',
'sensor' => 0,
);
$export['farm_map_source_google_terrain'] = $ol_source;
$ol_source = new stdClass();
$ol_source->disabled = FALSE; /* Edit this to true to make a default ol_source disabled initially */
$ol_source->api_version = 1;
$ol_source->machine_name = 'farm_map_source_openstreetmap';
$ol_source->name = 'Farm Map: OpenStreetMap';
$ol_source->description = '';
$ol_source->factory_service = 'openlayers.Source:OSM';
$ol_source->options = array();
$export['farm_map_source_openstreetmap'] = $ol_source;
return $export;
}

View File

@ -1,126 +0,0 @@
<?php
/**
* @file
* farm_map.default_openlayers_styles.inc
*/
/**
* Implements hook_default_openlayers_styles().
*/
function farm_map_default_openlayers_styles() {
$export = array();
// Define the farm styles.
$styles = array(
'farm_map_style_blue' => array(
'name' => 'Farm Blue',
'color' => 'rgba(51,153,255,1)',
),
'farm_map_style_dark_green' => array(
'name' => 'Farm Dark Green',
'color' => 'rgba(51,153,51,1)',
),
'farm_map_style_green' => array(
'name' => 'Farm Green',
'color' => 'rgba(102,204,102,1)',
),
'farm_map_style_grey' => array(
'name' => 'Farm Grey',
'color' => 'rgba(204,204,204,0.7)',
),
'farm_map_style_orange' => array(
'name' => 'Farm Orange',
'color' => 'rgba(255,153,51,1)',
),
'farm_map_style_purple' => array(
'name' => 'Farm Purple',
'color' => 'rgba(204,51,102,1)',
),
'farm_map_style_red' => array(
'name' => 'Farm Red',
'color' => 'rgba(204,0,0,1)',
),
'farm_map_style_yellow' => array(
'name' => 'Farm Yellow',
'color' => 'rgba(255,255,51,1)',
),
);
// Iterate through the defined styles and create them.
foreach ($styles as $machine_name => $style) {
$ol_style = new stdClass();
$ol_style->disabled = FALSE; /* Edit this to true to make a default ol_style disabled initially */
$ol_style->api_version = 1;
$ol_style->machine_name = $machine_name;
$ol_style->name = t($style['name']);
$ol_style->description = '';
$ol_style->factory_service = 'openlayers.Style:InlineJS';
$ol_style->options = array(
'javascript' => 'var fill = new ol.style.Fill({
color: "rgba(0,0,0,0)"
});
var stroke = new ol.style.Stroke({
color: "' . $style['color'] . '",
width: 2
});
var style = [
new ol.style.Style({
image: new ol.style.Circle({
fill: fill,
stroke: stroke,
radius: 4
}),
fill: fill,
stroke: stroke
})
];
return style;',
);
$export[$machine_name] = $ol_style;
}
// Add a cluster style type.
$ol_style = new stdClass();
$ol_style->disabled = FALSE; /* Edit this to true to make a default ol_style disabled initially */
$ol_style->api_version = 1;
$ol_style->machine_name = 'farm_map_style_cluster';
$ol_style->name = 'Farm Cluster';
$ol_style->description = '';
$ol_style->factory_service = 'openlayers.Style:Cluster';
$ol_style->options = array();
$export['farm_map_style_cluster'] = $ol_style;
// Add styles for Geofield editing/viewing.
$ol_style = new stdClass();
$ol_style->api_version = 1;
$ol_style->machine_name = 'farm_map_style_geofield';
$ol_style->name = 'Farm Map Geofield Edit';
$ol_style->description = '';
$ol_style->factory_service = 'openlayers.Style:Circle';
$ol_style->options = array(
'default' => array(
'image' => array(
'radius' => 4,
'fill' => array(
'color' => '0, 0, 0, 0',
),
'stroke' => array(
'color' => '255, 153, 51, 1',
'width' => 4,
'lineDash' => '0,0',
),
),
'stroke' => array(
'color' => '255, 153, 51, 1',
'width' => 4,
'lineDash' => '0,0',
),
'fill' => array(
'color' => '0, 0, 0, 0',
),
),
);
$export['farm_map_style_geofield'] = $ol_style;
return $export;
}

View File

@ -1,32 +0,0 @@
<?php
/**
* @file
* farm_map.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function farm_map_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "openlayers" && $api == "default_openlayers_components") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_controls") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_interactions") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_layers") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_maps") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_sources") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_styles") {
return array("version" => "1");
}
}

View File

@ -1,43 +1,11 @@
name = Farm Map
description = Provides OpenLayers configuration for farm maps.
description = Provides farm map features.
core = 7.x
package = farmOS
dependencies[] = ctools
dependencies[] = farm_quantity
dependencies[] = features
dependencies[] = geofield
dependencies[] = geophp
dependencies[] = libraries
dependencies[] = openlayers
dependencies[] = openlayers_geofield
dependencies[] = openlayers_geolocate_button
dependencies[] = openlayers_library
features[ctools][] = openlayers:default_openlayers_components:1
features[ctools][] = openlayers:default_openlayers_controls:1
features[ctools][] = openlayers:default_openlayers_layers:1
features[ctools][] = openlayers:default_openlayers_maps:1
features[ctools][] = openlayers:default_openlayers_sources:1
features[ctools][] = openlayers:default_openlayers_styles:1
features[features_api][] = api:2
features[field_base][] = field_farm_geofield
features[openlayers_components][] = farm_map_component_geofield_widget
features[openlayers_components][] = farm_map_component_geofield_zoom_to_source
features[openlayers_components][] = farm_map_component_progress_bar
features[openlayers_controls][] = farm_map_control_geocoder
features[openlayers_controls][] = farm_map_control_geofield
features[openlayers_controls][] = farm_map_control_geolocate
features[openlayers_controls][] = farm_map_control_layer_switcher
features[openlayers_layers][] = farm_map_geofield_formatter_layer_group
features[openlayers_layers][] = farm_map_geofield_widget_layer_group
features[openlayers_layers][] = farm_map_layer_google_hybrid
features[openlayers_layers][] = farm_map_layer_google_satellite
features[openlayers_layers][] = farm_map_layer_google_terrain
features[openlayers_layers][] = farm_map_layer_group
features[openlayers_layers][] = farm_map_layer_openstreetmap
features[openlayers_maps][] = farm_map_geofield
features[openlayers_maps][] = farm_map_geofield_formatter
features[openlayers_sources][] = farm_map_source_google_hybrid
features[openlayers_sources][] = farm_map_source_google_satellite
features[openlayers_sources][] = farm_map_source_google_terrain
features[openlayers_sources][] = farm_map_source_openstreetmap
registry_autoload[] = PSR-4

View File

@ -8,15 +8,7 @@
* Copy the Google Maps API key into the new configuration variable.
*/
function farm_map_update_7000(&$sandbox) {
// Load the Google Hybrid source.
$source = \Drupal\openlayers\Openlayers::load('Source', 'farm_map_source_google_hybrid');
// If an API key is set, copy it to the variable.
$key = $source->getOption('key');
if (!empty($key)) {
variable_set('farm_map_google_api_key', $key);
}
// Removed.
}
/**

View File

@ -5,7 +5,6 @@
*/
include_once 'farm_map.block.inc';
include_once 'farm_map.features.inc';
include_once 'farm_map.geo.inc';
/**
@ -280,21 +279,6 @@ function farm_map_settings_form($form, &$form_state) {
return system_settings_form($form);
}
/**
* Implements hook_openlayers_object_preprocess_alter().
*/
function farm_map_openlayers_object_preprocess_alter(&$build, $context) {
// If the object is a Map...
if ($context instanceof Drupal\openlayers\Types\MapInterface) {
// If the map machine name starts with "farm_", add farm map CSS.
if (substr($context->getMachineName(), 0, 5) == 'farm_') {
drupal_add_css(drupal_get_path('module', 'farm_map') . '/css/farm_map.css');
}
}
}
/**
* Extract geometries from an entity.
*
@ -328,22 +312,6 @@ function farm_map_farm_map_entity_geometries($entity_type, $entity) {
return $geometries;
}
/**
* Implements hook_module_implements_alter().
*/
function farm_map_module_implements_alter(&$implementations, $hook) {
// Ensure that this module's implementation of
// hook_default_openlayers_maps_alter() always runs last, so that it can add
// the "base layers" group to the bottom of the layers list on all farm maps.
// @see farm_map_default_openlayers_maps_alter()
if ($hook == 'default_openlayers_maps_alter' && array_key_exists('farm_map', $implementations)) {
$group = $implementations['farm_map'];
unset($implementations['farm_map']);
$implementations['farm_map'] = $group;
}
}
/**
* Helper function for populating the geometry field of an entity.
*

View File

@ -1,34 +0,0 @@
<?php
/**
* @file
* Control: OLGeocoder.
*/
namespace Drupal\farm_map\Plugin\Control\OLGeocoder;
use Drupal\openlayers\Types\Control;
use Drupal\openlayers\Types\BaseInterface;
/**
* Class OLGeocoder.
*
* @OpenlayersPlugin(
* id = "OLGeocoder",
* description = "Geocoder Nominatim for OpenLayers"
* )
*/
class OLGeocoder extends Control {
/**
* {@inheritdoc}
*/
public function preBuild(array &$build, BaseInterface $context = NULL) {
parent::preBuild($build, $context);
$options = array(
'type' => 'external',
'weight' => 100,
);
drupal_add_js('https://cdn.jsdelivr.net/npm/ol-geocoder', $options);
drupal_add_css('https://cdn.jsdelivr.net/npm/ol-geocoder@latest/dist/ol-geocoder.min.css', $options);
}
}

View File

@ -1,3 +0,0 @@
.ol-geocoder ul.gcd-gl-result>li {
line-height: normal !important;
}

View File

@ -1,17 +0,0 @@
Drupal.openlayers.pluginManager.register({
fs: 'openlayers.Control:OLGeocoder',
init: function(data) {
try {
var geocoder = new Geocoder('nominatim', {
provider: 'osm',
placeholder: 'Search for address...',
limit: 5,
autoComplete: true
});
data.map.addControl(geocoder);
}
catch(err) {
console.log(err.message);
}
}
});

View File

@ -1,66 +0,0 @@
<?php
/**
* @file
* farm_movement.default_openlayers_components.inc
*/
/**
* Implements hook_default_openlayers_components().
*/
function farm_movement_default_openlayers_components() {
$export = array();
// Get farm asset types.
$asset_types = farm_asset_types();
// Create an array of sources to zoom to.
$sources = array();
foreach ($asset_types as $type => $info) {
$source = 'farm_asset_full_source_' . $type;
$sources[$source] = $source;
}
// Define a zoom-to-source component that applies to all asset sources.
$ol_component = new stdClass();
$ol_component->disabled = FALSE; /* Edit this to true to make a default ol_component disabled initially */
$ol_component->api_version = 1;
$ol_component->machine_name = 'farm_asset_component_assets_zoom_to_source';
$ol_component->name = 'Farm Asset: Assets Zoom to Source';
$ol_component->description = 'Automatically zoom to the asset source when the map is first built.';
$ol_component->factory_service = 'openlayers.Component:ZoomToSource';
$ol_component->options = array(
'source' => $sources,
'duration' => 500,
'zoom' => 'auto',
'max_zoom' => 20,
'process_once' => 0,
);
$export['farm_asset_component_assets_zoom_to_source'] = $ol_component;
// Create an array of layers to enable popups on.
$layers = array();
foreach ($asset_types as $type => $info) {
$layer = 'farm_asset_cluster_layer_' . $type;
$layers[$layer] = $layer;
}
// Create a popup component for cluster layers.
$ol_component = new stdClass();
$ol_component->disabled = FALSE; /* Edit this to true to make a default ol_component disabled initially */
$ol_component->api_version = 1;
$ol_component->machine_name = 'farm_asset_component_assets_popup';
$ol_component->name = 'Farm Asset: Assets Popup';
$ol_component->description = '';
$ol_component->factory_service = 'openlayers.Component:Popup';
$ol_component->options = array(
'frontend_layers' => $layers,
'positioning' => 'top-right',
'autoPan' => TRUE,
'autoPanAnimation' => 0,
'autoPanMargin' => 20,
'closer' => 1,
);
$export['farm_asset_component_assets_popup'] = $ol_component;
return $export;
}

View File

@ -1,58 +0,0 @@
<?php
/**
* @file
* farm_movement.default_openlayers_layers.inc
*/
/**
* Implements hook_default_openlayers_layers().
*/
function farm_movement_default_openlayers_layers() {
$export = array();
// Load all available asset types.
$asset_types = farm_asset_types();
// Iterate through the available types, and add two layers for each one:
// a full geometry layer, and a cluster layer.
foreach ($asset_types as $key => $type) {
// Generate a machine name for the full geometry layer.
$full_layer_name = 'farm_asset_full_layer_' . $key;
// Define the full geometry layer.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = $full_layer_name;
$ol_layer->name = 'Farm Assets: ' . $type->label . ' (full geometry)';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Vector';
$ol_layer->options = array(
'source' => 'farm_asset_full_source_' . $key,
'visible' => 1,
'zoomActivity' => '',
'style' => 'farm_map_style_yellow',
);
$export[$full_layer_name] = $ol_layer;
// Generate a machine name for the cluster layer.
$cluster_layer_name = 'farm_asset_cluster_layer_' . $key;
// Define the cluster layer.
$ol_layer = new stdClass();
$ol_layer->disabled = FALSE; /* Edit this to true to make a default ol_layer disabled initially */
$ol_layer->api_version = 1;
$ol_layer->machine_name = $cluster_layer_name;
$ol_layer->name = 'Farm Assets: ' . $type->label . ' (cluster)';
$ol_layer->description = '';
$ol_layer->factory_service = 'openlayers.Layer:Vector';
$ol_layer->options = array(
'source' => 'farm_asset_cluster_source_' . $key,
'style' => 'farm_map_style_cluster',
);
$export[$cluster_layer_name] = $ol_layer;
}
return $export;
}

View File

@ -1,75 +0,0 @@
<?php
/**
* @file
* farm_movement.default_openlayers_maps.inc
*/
/**
* Implements hook_default_openlayers_maps().
*/
function farm_movement_default_openlayers_maps() {
$export = array();
// Get farm asset types.
$asset_types = farm_asset_types();
// Create a map for each asset type.
foreach ($asset_types as $key => $type) {
// Generate a machine name.
$machine_name = 'farm_assets_' . $key;
// Build the map.
$ol_map = new stdClass();
$ol_map->disabled = FALSE; /* Edit this to true to make a default ol_map disabled initially */
$ol_map->api_version = 1;
$ol_map->machine_name = $machine_name;
$ol_map->name = 'Farm Assets: ' . $type->label;
$ol_map->description = '';
$ol_map->factory_service = 'openlayers.Map:OLMap';
$ol_map->options = array(
'width' => 'auto',
'height' => '500px',
'provideBlockLayerSwitcher' => 0,
'view' => array(
'center' => array(
'lat' => 0,
'lon' => 0,
),
'rotation' => 0,
'zoom' => 2,
'minZoom' => 0,
'maxZoom' => 24,
),
'renderer' => 'canvas',
'layers' => array(
0 => 'farm_asset_cluster_layer_' . $key,
1 => 'farm_asset_full_layer_' . $key,
2 => 'farm_area_layer_areas_group',
),
'controls' => array(
0 => 'openlayers_control_zoom',
1 => 'openlayers_control_scaleline',
2 => 'farm_map_control_layer_switcher',
3 => 'farm_map_control_geolocate',
4 => 'farm_map_control_geocoder',
),
'interactions' => array(
0 => 'openlayers_interaction_doubleclickzoom',
1 => 'openlayers_interaction_dragpan',
2 => 'openlayers_interaction_mousewheelzoom',
3 => 'openlayers_interaction_pinchzoom',
),
'components' => array(
0 => 'farm_asset_component_assets_zoom_to_source',
1 => 'farm_asset_component_assets_popup',
2 => 'farm_map_component_progress_bar',
),
);
// Add the map to the export.
$export[$machine_name] = $ol_map;
}
return $export;
}

View File

@ -1,80 +0,0 @@
<?php
/**
* @file
* farm_movement.default_openlayers_sources.inc
*/
/**
* Implements hook_default_openlayers_sources().
*/
function farm_movement_default_openlayers_sources() {
$export = array();
// Load all available farm asset types.
$asset_types = farm_asset_types();
// Iterate through the available types, and add a source for each one.
foreach ($asset_types as $key => $type) {
// Generate a machine name for the full geometry source.
$full_source_name = 'farm_asset_full_source_' . $key;
// Build the full geometry source.
$ol_source = new stdClass();
$ol_source->disabled = FALSE; /* Edit this to true to make a default ol_source disabled initially */
$ol_source->api_version = 1;
$ol_source->machine_name = $full_source_name;
$ol_source->name = 'Farm Assets: ' . $type->label . ' (full geometry)';
$ol_source->description = 'This source is automatically generated by the Farm Log module.';
$ol_source->factory_service = 'openlayers.Source:GeoJSON';
$ol_source->options = array(
'url' => 'farm/assets/geojson/full/' . $key,
'useBBOX' => 0,
'paramForwarding' => 1,
'reloadOnZoomChange' => 0,
'reloadOnExtentChange' => 0,
'geojson_data' => '',
);
$export[$full_source_name] = $ol_source;
// Generate a machine name for the centroid source.
$centroid_source_name = 'farm_asset_centroid_source_' . $key;
// Build the centroid source.
$ol_source = new stdClass();
$ol_source->disabled = FALSE; /* Edit this to true to make a default ol_source disabled initially */
$ol_source->api_version = 1;
$ol_source->machine_name = $centroid_source_name;
$ol_source->name = 'Farm Assets: ' . $type->label . ' (centroid)';
$ol_source->description = 'This source is automatically generated by the Farm Log module.';
$ol_source->factory_service = 'openlayers.Source:GeoJSON';
$ol_source->options = array(
'url' => 'farm/assets/geojson/centroid/' . $key,
'useBBOX' => 0,
'paramForwarding' => 1,
'reloadOnZoomChange' => 0,
'reloadOnExtentChange' => 0,
'geojson_data' => '',
);
$export[$centroid_source_name] = $ol_source;
// Generate a machine name for the cluster source.
$cluster_source_name = 'farm_asset_cluster_source_' . $key;
// Build the cluster source.
$ol_source = new stdClass();
$ol_source->disabled = FALSE; /* Edit this to true to make a default ol_source disabled initially */
$ol_source->api_version = 1;
$ol_source->machine_name = $cluster_source_name;
$ol_source->name = 'Farm Assets: ' . $type->label . ' (cluster)';
$ol_source->description = '';
$ol_source->factory_service = 'openlayers.Source:Cluster';
$ol_source->options = array(
'source' => $centroid_source_name,
'distance' => '50',
);
$export[$cluster_source_name] = $ol_source;
}
return $export;
}

View File

@ -11,18 +11,6 @@ function farm_movement_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "field_group" && $api == "field_group") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_components") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_layers") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_maps") {
return array("version" => "1");
}
if ($module == "openlayers" && $api == "default_openlayers_sources") {
return array("version" => "1");
}
}
/**

View File

@ -22,7 +22,6 @@ dependencies[] = field_group
dependencies[] = geofield
dependencies[] = geophp
dependencies[] = log
dependencies[] = openlayers_geofield
dependencies[] = options
dependencies[] = taxonomy
dependencies[] = views

View File

@ -23,8 +23,6 @@ dependencies[] = list
dependencies[] = log
dependencies[] = multiupload_filefield_widget
dependencies[] = multiupload_imagefield_widget
dependencies[] = openlayers
dependencies[] = openlayers_geofield
dependencies[] = options
dependencies[] = taxonomy
dependencies[] = text

View File

@ -23,7 +23,6 @@ dependencies[] = list
dependencies[] = log
dependencies[] = multiupload_filefield_widget
dependencies[] = multiupload_imagefield_widget
dependencies[] = openlayers_geofield
dependencies[] = options
dependencies[] = taxonomy
dependencies[] = text

View File

@ -213,21 +213,6 @@ h2.resp-tab-active,
padding-left: 0;
}
/**
* Increase the default font size within maps to create larger buttons.
*/
.openlayers-map-container .gm-style {
font-size: 16px;
}
/**
* Set max-height and overflow styles for layerswitcher.
*/
.openlayers-map-container .layer-switcher .panel {
max-height: 400px;
overflow-y: auto;
}
/**
* Fix Modal popup close button (x).
* See https://www.drupal.org/node/2563967