mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Issue #2551091: Show map on /locations
This commit is contained in:
parent
1b2ce0b075
commit
dc00956117
|
@ -0,0 +1,12 @@
|
||||||
|
langcode: en
|
||||||
|
status: true
|
||||||
|
dependencies:
|
||||||
|
enforced:
|
||||||
|
module:
|
||||||
|
- farm_ui_location
|
||||||
|
id: locations
|
||||||
|
label: Locations
|
||||||
|
description: 'The farmOS locations map.'
|
||||||
|
behaviors:
|
||||||
|
- locations
|
||||||
|
options: { }
|
|
@ -6,5 +6,6 @@ core_version_requirement: ^10
|
||||||
dependencies:
|
dependencies:
|
||||||
- farm:farm_entity
|
- farm:farm_entity
|
||||||
- farm:farm_location
|
- farm:farm_location
|
||||||
|
- farm:farm_ui_map
|
||||||
- farm:farm_ui_menu
|
- farm:farm_ui_menu
|
||||||
- inspire_tree:inspire_tree
|
- inspire_tree:inspire_tree
|
||||||
|
|
33
modules/core/ui/location/farm_ui_location.post_update.php
Normal file
33
modules/core/ui/location/farm_ui_location.post_update.php
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Post update functions for farm_ui_location module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Drupal\farm_map\Entity\MapType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add farmOS locations map type.
|
||||||
|
*/
|
||||||
|
function farm_ui_location_post_update_add_locations_map_type(&$sandbox = NULL) {
|
||||||
|
|
||||||
|
// Create locations map type.
|
||||||
|
$map_type = MapType::create([
|
||||||
|
'id' => 'locations',
|
||||||
|
'label' => 'Locations',
|
||||||
|
'description' => 'The farmOS locations map.',
|
||||||
|
'behaviors' => [
|
||||||
|
'location',
|
||||||
|
],
|
||||||
|
'options' => [],
|
||||||
|
'dependencies' => [
|
||||||
|
'enforced' => [
|
||||||
|
'module' => [
|
||||||
|
'farm_ui_location',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$map_type->save();
|
||||||
|
}
|
|
@ -112,6 +112,14 @@ class LocationHierarchyForm extends FormBase {
|
||||||
*/
|
*/
|
||||||
public function buildForm(array $form, FormStateInterface $form_state, AssetInterface $asset = NULL) {
|
public function buildForm(array $form, FormStateInterface $form_state, AssetInterface $asset = NULL) {
|
||||||
|
|
||||||
|
// If no asset was specified, show a map of all locations.
|
||||||
|
if (is_null($asset)) {
|
||||||
|
$form['map'] = [
|
||||||
|
'#type' => 'farm_map',
|
||||||
|
'#map_type' => 'locations',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
// Add a DIV for the JavaScript content.
|
// Add a DIV for the JavaScript content.
|
||||||
$form['content'] = [
|
$form['content'] = [
|
||||||
'#type' => 'html_tag',
|
'#type' => 'html_tag',
|
||||||
|
|
Loading…
Reference in a new issue