Add the agaric_migration module

This commit is contained in:
David Valdez 2018-08-22 12:50:20 -05:00 committed by benjamin melançon
parent e38187bc7d
commit 331e22299a
4 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,10 @@
name: Agaric Migration
description: Migrate the content from the D7 version of the site.
package: Custom
type: module
core: 8.x
dependencies:
- drupal:migrate
- drupal:migrate_drupal
- migrate_plus:migrate_plus
- migrate_tools:migrate_tools

View file

@ -0,0 +1,11 @@
id: agaric
label: Agaric Group
description: Agaric migrations.
source_type: Drupal 7
shared_configuration:
source:
key: migrate
dependencies:
enforced:
module:
- agaric_migration

View file

@ -0,0 +1,32 @@
id: agaric_user
migration_group: agaric
label: Agaric Users
source:
plugin: d7_user
destination:
plugin: entity:user
process:
name: name
pass: pass
mail: mail
created: created
access: access
login: login
status: status
timezone: timezone
init: init
roles:
-
plugin: static_map
source: roles
map:
1: anonymous
2: authenticated
3: staff
4: administrator
5: past
6: partner
-
plugin: role_generate
entity_type: user_role
value_key: id

View file

@ -0,0 +1,36 @@
<?php
namespace Drupal\agaric_migration\Plugin\migrate\process;
use Drupal\migrate_plus\Plugin\migrate\process\EntityGenerate;
/**
* RoleGenerate migrate plugin.
*
* Basically just extends the EntityGenerate module and overwrite the entity
* method and there just set a label to the role.
*
* @MigrateProcessPlugin(
* id = "role_generate"
* )
*
* @see EntityGenerate
*/
class RoleGenerate extends EntityGenerate {
/**
* Gives a proper label to the role.
*
* @param mixed $value
* Primary value to use in creation of the entity.
*
* @return array
* Entity value array.
*/
protected function entity($value) {
$entity_values = parent::entity($value);
$entity_values['label'] = ucfirst($value);
return $entity_values;
}
}