cforge-2.0.x-dev/modules/cforge_network/cforge_network.install
modules/cforge_network/cforge_network.install
<?php
use \Drupal\Core\Entity\Entity\EntityFormDisplay;
use \Drupal\Core\Entity\Entity\EntityViewDisplay;
/**
* Implements hook_install().
*/
function cforge_network_install() {
$murm_conf = \Drupal::configFactory()->getEditable('murmurations.settings');
$plugins = $murm_conf->get('plugins');
$plugins[0]['aggregator'] = 'http://index.murmurations.network/v2';
$plugins['offer_want']['aggregator'] = 'http://murmagg.communityforge.net';
$plugins['community_currency']['aggregator'] = 'http://index.murmurations.network/v2';
$murm_conf->set('plugins', $plugins)->save();
$settings = [
'type' => 'leaflet_widget_default',
'weight' => 4,
'region' => 'content',
'settings' => [
'leaflet_map' => 'OSM Mapnik',
'height' => '200',
'locate' => '0',
'auto_center' => '1',
'map_position' => [
'force' => false,
'zoom' => 12,
'minZoom' => 1,
'maxZoom' => 18,
'zoomFiner' => 0
],
'scroll_zoom_enabled' => 1,
],
'input' => [
'show' => true,
'readonly' => false
],
'third_party_settings' => []
];
EntityFormDisplay::load('user.user.profile')
->setComponent('coordinates', $settings)
->save();
$settings = [
'type' => 'leaflet_formatter_default',
'label' => 'hidden',
'settings' => [
'multiple_map' => false,
'leaflet_map' => 'OSM Mapnik',
'height' => 200,
'height_unit' => 'px',
'hide_empty_map' => true,
'gesture_handling' => false,
'disable_wheel' => false
],
'map_position' => [
'force' => false,
'zoom' => 12,
'minZoom' => 10,
'maxZoom' => 18,
'zoomFiner' => 0
],
'icon' => [
'iconType' => 'marker',
'html' => '<div></div>',
'html_class' => 'leaflet-map-divicon',
],
'third_party_settings' => [],
'weight' => 2,
'region' => 'content'
];
EntityViewDisplay::load('user.user.default')
->setComponent('coordinates', $settings)
->save();
}
