Move KML export actions to new farm_export_kml module.
This commit is contained in:
parent
146719f363
commit
07882e177a
|
@ -57,7 +57,7 @@ function farm_modules() {
|
|||
'farm_birth' => t('Birth logs'),
|
||||
'farm_medical' => t('Medical logs'),
|
||||
'farm_import_csv' => t('CSV importer'),
|
||||
'farm_kml' => t('KML export features'),
|
||||
'farm_export_kml' => t('KML exporter'),
|
||||
'farm_import_kml' => t('KML asset importer'),
|
||||
'farm_map_mapbox' => t('Mapbox map layers: Satellite, Outdoors'),
|
||||
'farm_api_default_consumer' => t('Default API Consumer'),
|
||||
|
|
|
@ -3,7 +3,7 @@ status: true
|
|||
dependencies:
|
||||
module:
|
||||
- asset
|
||||
- farm_kml
|
||||
- farm_export_kml
|
||||
id: asset_kml_action
|
||||
label: 'Export KML'
|
||||
type: asset
|
|
@ -2,7 +2,7 @@ langcode: en
|
|||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- farm_kml
|
||||
- farm_export_kml
|
||||
- log
|
||||
id: log_kml_action
|
||||
label: 'Export KML'
|
|
@ -0,0 +1,8 @@
|
|||
name: farmOS Export KML
|
||||
description: Provides a KML export action for farmOS.
|
||||
type: module
|
||||
package: farmOS
|
||||
core_version_requirement: ^10
|
||||
dependencies:
|
||||
- farm:farm_export
|
||||
- farm:farm_kml
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_kml\Plugin\Action\Derivative;
|
||||
namespace Drupal\farm_export_kml\Plugin\Action\Derivative;
|
||||
|
||||
use Drupal\Core\Action\Plugin\Action\Derivative\EntityActionDeriverBase;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
|
@ -8,7 +8,7 @@ use Drupal\Core\Entity\EntityTypeInterface;
|
|||
/**
|
||||
* Provides an action deriver for the KML action.
|
||||
*
|
||||
* @see \Drupal\farm_kml\Plugin\Action\EntityKml
|
||||
* @see \Drupal\farm_export_kml\Plugin\Action\EntityKml
|
||||
*/
|
||||
class EntityKmlDeriver extends EntityActionDeriverBase {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_kml\Plugin\Action;
|
||||
namespace Drupal\farm_export_kml\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\Plugin\Action\EntityActionBase;
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
|
@ -18,7 +18,7 @@ use Symfony\Component\Serializer\SerializerInterface;
|
|||
* @Action(
|
||||
* id = "entity:kml_action",
|
||||
* action_label = @Translation("Export entity geometry as KML"),
|
||||
* deriver = "Drupal\farm_kml\Plugin\Action\Derivative\EntityKmlDeriver",
|
||||
* deriver = "Drupal\farm_export_kml\Plugin\Action\Derivative\EntityKmlDeriver",
|
||||
* )
|
||||
*/
|
||||
class EntityKml extends EntityActionBase {
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Post update functions for farm_kml module.
|
||||
*/
|
||||
|
||||
use Drupal\system\Entity\Action;
|
||||
|
||||
/**
|
||||
* Move KML export actions to new farm_export_kml module.
|
||||
*/
|
||||
function farm_kml_post_update_move_kml_export_actions(&$sandbox = NULL) {
|
||||
|
||||
// Delete the existing KML export action config entities.
|
||||
$configs = Action::loadMultiple(['asset_kml_action', 'log_kml_action']);
|
||||
foreach ($configs as $config) {
|
||||
$config->delete();
|
||||
}
|
||||
|
||||
// Install the farm_export_kml module. This will recreate the actions.
|
||||
if (!\Drupal::service('module_handler')->moduleExists('farm_export_kml')) {
|
||||
\Drupal::service('module_installer')->install(['farm_export_kml']);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue