Skip to content
GitLab
Explore
Sign in
project
drupal
Compare revisions
c5ce86234f84acab47b7dc892b55504536875ccd to 8.1.x
Hide whitespace changes
Inline
Side-by-side
core/modules/migrate/src/Plugin/migrate/process/Callback.php
View file @
614ba415
...
...
@@ -15,6 +15,8 @@
* arguments can be passed to the callback as this would make the migration YAML
* file too complex.
*
* @link https://www.drupal.org/node/2181783 Online handbook documentation for callback process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "callback"
* )
...
...
core/modules/migrate/src/Plugin/migrate/process/Concat.php
View file @
614ba415
...
...
@@ -10,6 +10,8 @@
/**
* Concatenates the strings in the current value.
*
* @link https://www.drupal.org/node/2345927 Online handbook documentation for concat process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "concat",
* handle_multiples = TRUE
...
...
core/modules/migrate/src/Plugin/migrate/process/DedupeBase.php
View file @
614ba415
...
...
@@ -15,6 +15,8 @@
* creating filter format names, the current value is checked against the
* existing filter format names and if it exists, a numeric postfix is added
* and incremented until a unique value is created.
*
* @link https://www.drupal.org/node/2345929 Online handbook documentation for dedupebase process plugin @endlink
*/
abstract
class
DedupeBase
extends
ProcessPluginBase
{
...
...
core/modules/migrate/src/Plugin/migrate/process/DedupeEntity.php
View file @
614ba415
...
...
@@ -10,6 +10,8 @@
/**
* Ensures value is not duplicated against an entity field.
*
* @link https://www.drupal.org/node/2135325 Online handbook documentation for dedupe_entity process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "dedupe_entity"
* )
...
...
core/modules/migrate/src/Plugin/migrate/process/DefaultValue.php
View file @
614ba415
...
...
@@ -9,6 +9,8 @@
/**
* This plugin sets missing values on the destination.
*
* @link https://www.drupal.org/node/2135313 Online handbook documentation for default_value process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "default_value"
* )
...
...
core/modules/migrate/src/Plugin/migrate/process/Explode.php
View file @
614ba415
...
...
@@ -10,6 +10,8 @@
/**
* This plugin explodes a delimited string into an array of values.
*
* @link https://www.drupal.org/node/2674504 Online handbook documentation for explode process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "explode"
* )
...
...
core/modules/migrate/src/Plugin/migrate/process/Extract.php
View file @
614ba415
...
...
@@ -11,7 +11,7 @@
/**
* This plugin extracts a value from an array.
*
* @
see
https://www.drupal.org/node/2152731
* @
link
https://www.drupal.org/node/2152731
Online handbook documentation for extract process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "extract"
...
...
core/modules/migrate/src/Plugin/migrate/process/Flatten.php
View file @
614ba415
...
...
@@ -12,7 +12,7 @@
* once a single value gets transformed into multiple values. This plugin will
* flatten them back down to single values again.
*
* @
see
https://www.drupal.org/node/2154215
* @
link
https://www.drupal.org/node/2154215
Online handbook documentation for flatten process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "flatten",
...
...
core/modules/migrate/src/Plugin/migrate/process/Get.php
View file @
614ba415
...
...
@@ -9,6 +9,8 @@
/**
* This plugin copies from the source to the destination.
*
* @link https://www.drupal.org/node/2135307 Online handbook documentation for get process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "get"
* )
...
...
core/modules/migrate/src/Plugin/migrate/process/Iterator.php
View file @
614ba415
...
...
@@ -9,7 +9,7 @@
/**
* This plugin iterates and processes an array.
*
* @
see
https://www.drupal.org/node/2135345
* @
link
https://www.drupal.org/node/2135345
Online handbook documentation for iterator process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "iterator",
...
...
core/modules/migrate/src/Plugin/migrate/process/MachineName.php
View file @
614ba415
...
...
@@ -17,6 +17,8 @@
* and replaced by an underscore and multiple underscores are collapsed into
* one.
*
* @link https://www.drupal.org/node/2135323 Online handbook documentation for machine_name process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "machine_name"
* )
...
...
core/modules/migrate/src/Plugin/migrate/process/Migration.php
View file @
614ba415
...
...
@@ -4,7 +4,7 @@
use
Drupal\Core\Plugin\ContainerFactoryPluginInterface
;
use
Drupal\migrate\MigrateSkipProcessException
;
use
Drupal\migrate\Plugin\MigratePluginManager
;
use
Drupal\migrate\Plugin\MigratePluginManager
Interface
;
use
Drupal\migrate\Plugin\MigrationPluginManagerInterface
;
use
Drupal\migrate\Plugin\MigrateIdMapInterface
;
use
Drupal\migrate\ProcessPluginBase
;
...
...
@@ -16,6 +16,8 @@
/**
* Calculates the value of a property based on a previous migration.
*
* @link https://www.drupal.org/node/2149801 Online handbook documentation for migration process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "migration"
* )
...
...
@@ -39,7 +41,7 @@ class Migration extends ProcessPluginBase implements ContainerFactoryPluginInter
/**
* {@inheritdoc}
*/
public
function
__construct
(
array
$configuration
,
$plugin_id
,
$plugin_definition
,
MigrationInterface
$migration
,
MigrationPluginManagerInterface
$migration_plugin_manager
,
MigratePluginManager
$process_plugin_manager
)
{
public
function
__construct
(
array
$configuration
,
$plugin_id
,
$plugin_definition
,
MigrationInterface
$migration
,
MigrationPluginManagerInterface
$migration_plugin_manager
,
MigratePluginManager
Interface
$process_plugin_manager
)
{
parent
::
__construct
(
$configuration
,
$plugin_id
,
$plugin_definition
);
$this
->
migrationPluginManager
=
$migration_plugin_manager
;
$this
->
migration
=
$migration
;
...
...
core/modules/migrate/src/Plugin/migrate/process/Route.php
View file @
614ba415
...
...
@@ -11,7 +11,10 @@
use
Drupal\migrate\Row
;
/**
* @MigrateProcessPlugin(
*
* @link https://www.drupal.org/node/2750777 Online handbook documentation for route process plugin @endlink
*
* * @MigrateProcessPlugin(
* id = "route"
* )
*/
...
...
core/modules/migrate/src/Plugin/migrate/process/SkipOnEmpty.php
View file @
614ba415
...
...
@@ -11,6 +11,8 @@
/**
* If the source evaluates to empty, we skip processing or the whole row.
*
* @link https://www.drupal.org/node/2228793 Online handbook documentation for skip_on_empty process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "skip_on_empty"
* )
...
...
core/modules/migrate/src/Plugin/migrate/process/SkipRowIfNotSet.php
View file @
614ba415
...
...
@@ -10,6 +10,8 @@
/**
* If the source evaluates to empty, we skip the current row.
*
* @link https://www.drupal.org/node/2345935 Online handbook documentation for skip_row_if_not_set process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "skip_row_if_not_set",
* handle_multiples = TRUE
...
...
core/modules/migrate/src/Plugin/migrate/process/StaticMap.php
View file @
614ba415
...
...
@@ -12,7 +12,7 @@
/**
* This plugin changes the current value based on a static lookup map.
*
* @
see
https://www.drupal.org/node/2143521
* @
link
https://www.drupal.org/node/2143521
Online handbook documentation for static_map process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "static_map"
...
...
core/modules/migrate/src/Plugin/migrate/process/Substr.php
View file @
614ba415
...
...
@@ -11,6 +11,8 @@
/**
* This plugin returns a substring of the current value.
*
* @link https://www.drupal.org/node/2771965 Online handbook documentation for substr process plugin @endlink
*
* @MigrateProcessPlugin(
* id = "substr"
* )
...
...
core/modules/migrate_drupal/src/Plugin/MigrateCckFieldPluginManager.php
View file @
614ba415
...
...
@@ -15,7 +15,7 @@
*
* @ingroup migration
*/
class
MigrateCckFieldPluginManager
extends
MigratePluginManager
{
class
MigrateCckFieldPluginManager
extends
MigratePluginManager
implements
MigrateCckFieldPluginManagerInterface
{
/**
* The default version of core to use for cck field plugins.
...
...
@@ -29,7 +29,7 @@ class MigrateCckFieldPluginManager extends MigratePluginManager {
/**
* {@inheritdoc}
*/
public
function
createInstanc
e
(
$field_type
,
array
$configuration
=
array
()
,
MigrationInterface
$migration
=
NULL
)
{
public
function
getPluginIdFromFieldTyp
e
(
$field_type
,
array
$configuration
=
[]
,
MigrationInterface
$migration
=
NULL
)
{
$core
=
static
::
DEFAULT_CORE_VERSION
;
if
(
!
empty
(
$configuration
[
'core'
]))
{
$core
=
$configuration
[
'core'
];
...
...
@@ -45,7 +45,7 @@ public function createInstance($field_type, array $configuration = array(), Migr
foreach
(
$this
->
getDefinitions
()
as
$plugin_id
=>
$definition
)
{
if
(
in_array
(
$core
,
$definition
[
'core'
]))
{
if
(
array_key_exists
(
$field_type
,
$definition
[
'type_map'
])
||
$field_type
===
$plugin_id
)
{
return
parent
::
createInstance
(
$plugin_id
,
$configuration
,
$migration
)
;
return
$plugin_id
;
}
}
}
...
...
core/modules/migrate_drupal/src/Plugin/MigrateCckFieldPluginManagerInterface.php
0 → 100644
View file @
614ba415
<?php
namespace
Drupal\migrate_drupal\Plugin
;
use
Drupal\migrate\Plugin\MigratePluginManagerInterface
;
use
Drupal\migrate\Plugin\MigrationInterface
;
interface
MigrateCckFieldPluginManagerInterface
extends
MigratePluginManagerInterface
{
/**
* Get the plugin ID from the field type.
*
* @param string $field_type
* The field type being migrated.
* @param array $configuration
* (optional) An array of configuration relevant to the plugin instance.
* @param \Drupal\migrate\Plugin\MigrationInterface|null $migration
* (optional) The current migration instance.
*
* @return string
* The ID of the plugin for the field_type if available.
*
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
* If the plugin cannot be determined, such as if the field type is invalid.
*/
public
function
getPluginIdFromFieldType
(
$field_type
,
array
$configuration
=
[],
MigrationInterface
$migration
=
NULL
);
}
core/modules/migrate_drupal/src/Plugin/migrate/CckMigration.php
View file @
614ba415
...
...
@@ -2,13 +2,15 @@
namespace
Drupal\migrate_drupal\Plugin\migrate
;
use
Drupal\Component\Plugin\Exception\PluginNotFoundException
;
use
Drupal\Core\Plugin\ContainerFactoryPluginInterface
;
use
Drupal\migrate\Exception\RequirementsException
;
use
Drupal\migrate\Plugin\MigrateDestinationPluginManager
;
use
Drupal\migrate\Plugin\MigratePluginManager
;
use
Drupal\migrate\Plugin\MigratePluginManager
Interface
;
use
Drupal\migrate\Plugin\Migration
;
use
Drupal\migrate\Plugin\MigrationPluginManagerInterface
;
use
Drupal\migrate\Plugin\RequirementsInterface
;
use
Drupal\migrate_drupal
\Plugin\MigrateCckFieldPluginManagerInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
...
...
@@ -40,7 +42,7 @@ class CckMigration extends Migration implements ContainerFactoryPluginInterface
/**
* The cckfield plugin manager.
*
* @var \Drupal\migrate\Plugin\MigratePluginManager
* @var \Drupal\migrate
_drupal
\Plugin\Migrate
CckField
PluginManager
Interface
*/
protected
$cckPluginManager
;
...
...
@@ -53,20 +55,20 @@ class CckMigration extends Migration implements ContainerFactoryPluginInterface
* The plugin ID.
* @param mixed $plugin_definition
* The plugin definition.
* @param \Drupal\migrate\Plugin\MigratePluginManager $cck_manager
* @param \Drupal\migrate
_drupal
\Plugin\Migrate
CckField
PluginManager
Interface
$cck_manager
* The cckfield plugin manager.
* @param \Drupal\migrate\Plugin\MigrationPluginManagerInterface $migration_plugin_manager
* The migration plugin manager.
* @param \Drupal\migrate\Plugin\MigratePluginManager $source_plugin_manager
* @param \Drupal\migrate\Plugin\MigratePluginManager
Interface
$source_plugin_manager
* The source migration plugin manager.
* @param \Drupal\migrate\Plugin\MigratePluginManager $process_plugin_manager
* @param \Drupal\migrate\Plugin\MigratePluginManager
Interface
$process_plugin_manager
* The process migration plugin manager.
* @param \Drupal\migrate\Plugin\MigrateDestinationPluginManager $destination_plugin_manager
* The destination migration plugin manager.
* @param \Drupal\migrate\Plugin\MigratePluginManager $idmap_plugin_manager
* @param \Drupal\migrate\Plugin\MigratePluginManager
Interface
$idmap_plugin_manager
* The ID map migration plugin manager.
*/
public
function
__construct
(
array
$configuration
,
$plugin_id
,
$plugin_definition
,
MigratePluginManager
$cck_manager
,
MigrationPluginManagerInterface
$migration_plugin_manager
,
MigratePluginManager
$source_plugin_manager
,
MigratePluginManager
$process_plugin_manager
,
MigrateDestinationPluginManager
$destination_plugin_manager
,
MigratePluginManager
$idmap_plugin_manager
)
{
public
function
__construct
(
array
$configuration
,
$plugin_id
,
$plugin_definition
,
Migrate
CckField
PluginManager
Interface
$cck_manager
,
MigrationPluginManagerInterface
$migration_plugin_manager
,
MigratePluginManager
Interface
$source_plugin_manager
,
MigratePluginManager
Interface
$process_plugin_manager
,
MigrateDestinationPluginManager
$destination_plugin_manager
,
MigratePluginManager
Interface
$idmap_plugin_manager
)
{
parent
::
__construct
(
$configuration
,
$plugin_id
,
$plugin_definition
,
$migration_plugin_manager
,
$source_plugin_manager
,
$process_plugin_manager
,
$destination_plugin_manager
,
$idmap_plugin_manager
);
$this
->
cckPluginManager
=
$cck_manager
;
}
...
...
@@ -106,12 +108,19 @@ public function getProcess() {
}
foreach
(
$source_plugin
as
$row
)
{
$field_type
=
$row
->
getSourceProperty
(
'type'
);
if
(
!
isset
(
$this
->
processedFieldTypes
[
$field_type
])
&&
$this
->
cckPluginManager
->
hasDefinition
(
$field_type
))
{
try
{
$plugin_id
=
$this
->
cckPluginManager
->
getPluginIdFromFieldType
(
$field_type
,
[],
$this
);
}
catch
(
PluginNotFoundException
$ex
)
{
continue
;
}
if
(
!
isset
(
$this
->
processedFieldTypes
[
$field_type
]))
{
$this
->
processedFieldTypes
[
$field_type
]
=
TRUE
;
// Allow the cckfield plugin to alter the migration as necessary so
// that it knows how to handle fields of this type.
if
(
!
isset
(
$this
->
cckPluginCache
[
$field_type
]))
{
$this
->
cckPluginCache
[
$field_type
]
=
$this
->
cckPluginManager
->
createInstance
(
$
field_type
,
[],
$this
);
$this
->
cckPluginCache
[
$field_type
]
=
$this
->
cckPluginManager
->
createInstance
(
$
plugin_id
,
[],
$this
);
}
call_user_func
([
$this
->
cckPluginCache
[
$field_type
],
$this
->
pluginDefinition
[
'cck_plugin_method'
]],
$this
);
}
...
...
Prev
1
2
3
4
Next