Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
M
migrate_devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
migrate_devel
Commits
4984acbe
Commit
4984acbe
authored
Feb 10, 2019
by
benjifisher
Committed by
Derimagia
Feb 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#3021648
by benjifisher, selwynpolit: Add a migrate plugin to debug one process step
parent
d56b84fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
src/Plugin/migrate/process/Debug.php
src/Plugin/migrate/process/Debug.php
+85
-0
No files found.
src/Plugin/migrate/process/Debug.php
0 → 100644
View file @
4984acbe
<?php
namespace
Drupal\migrate_devel\Plugin\migrate\process
;
use
Drupal\migrate\ProcessPluginBase
;
use
Drupal\migrate\MigrateException
;
use
Drupal\migrate\MigrateExecutableInterface
;
use
Drupal\migrate\Row
;
use
Drupal\migrate\MigrateSkipRowException
;
/**
* Debug the process pipeline.
*
* Prints the input value, assuming that you are running the migration from the
* command line, and sends it to the next step in the pipeline unaltered.
*
* Available configuration keys:
* - label: (optional) a string to print before the debug output. Include any
* trailing punctuation or space characters.
* - multiple: (optional) set to TRUE to ask the next step in the process
* pipeline to process array values individually, like the multiple_values
* plugin from the Migrate Plus module.
*
* Examples:
*
* @code
* process:
* field_tricky:
* -
* plugin: debug
* source: whatever
* -
* plugin: next
* @endcode
*
* This will print the source before passing it to the next plugin.
*
* @code
* process:
* field_tricky:
* -
* plugin: debug
* source: whatever
* label: 'Step 1: '
* multiple: true
* -
* plugin: next
* @endcode
*
* This does the same thing, but ensures that the next plugin will be called
* once for each item in the source, if the source is an array.
* It will also print "Debug Step 1: " before printing the source.
*
* @see \Drupal\migrate\Plugin\MigrateProcessInterface
*
* @MigrateProcessPlugin(
* id = "debug",
* handle_multiples = TRUE
* )
*/
class
Debug
extends
ProcessPluginBase
{
/**
* {@inheritdoc}
*/
public
function
transform
(
$value
,
MigrateExecutableInterface
$migrate_executable
,
Row
$row
,
$destination_property
)
{
if
(
isset
(
$this
->
configuration
[
'label'
]))
{
print_r
(
$this
->
configuration
[
'label'
]);
}
print_r
(
$value
);
if
(
!
is_array
(
$value
))
{
print_r
(
PHP_EOL
);
}
return
$value
;
}
/**
* {@inheritdoc}
*/
public
function
multiple
()
{
return
!
empty
(
$this
->
configuration
[
'multiple'
]);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment