Add the agaric_migration module
This commit is contained in:
parent
e38187bc7d
commit
331e22299a
4 changed files with 89 additions and 0 deletions
|
@ -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
|
11
web/modules/custom/agaric_migration/migrations/agaric.yml
Normal file
11
web/modules/custom/agaric_migration/migrations/agaric.yml
Normal 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
|
|
@ -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
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue