Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wordpress_migrate
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
wordpress_migrate
Commits
91469ec5
Commit
91469ec5
authored
1 month ago
by
Dan Feidt
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3491146
by ryumaou, HongPong: wordpress_migrate_log_term code cleanup.
parent
b27d638d
No related branches found
No related tags found
No related merge requests found
Pipeline
#461957
failed
1 month ago
Stage: build
Stage: validate
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Plugin/migrate/process/LogTerm.php
+29
-19
29 additions, 19 deletions
src/Plugin/migrate/process/LogTerm.php
with
29 additions
and
19 deletions
src/Plugin/migrate/process/LogTerm.php
+
29
−
19
View file @
91469ec5
<?php
/**
* Provides migrate process plugin "wordpress_migrate_log_term". Will log term
* ID, Name, Slug, Destination.
*/
namespace
Drupal\wordpress_migrate\Plugin\migrate\process
;
use
Drupal\migrate\ProcessPluginBase
;
use
Drupal\migrate\MigrateExecutableInterface
;
use
Drupal\migrate\Row
;
//use Drupal\migrate\MigrateSkipProcessException;
// Use Drupal\migrate\MigrateSkipProcessException;.
/**
* Provides migrate process plugin "wordpress_migrate_log_term". Will log term
* ID, Name, Slug, Destination.
*/
/**
* @MigrateProcessPlugin(
* id = "wordpress_migrate_log_term"
* )
*/
* @MigrateProcessPlugin(
* id = "wordpress_migrate_log_term"
* )
*/
class
LogTerm
extends
ProcessPluginBase
{
/**
*
*/
public
function
transform
(
$value
,
MigrateExecutableInterface
$migrate_executable
,
Row
$row
,
$destination_property
)
{
$source
=
$row
->
getSource
();
// Get original values for debugging
// Get original values for debugging
.
$term_id
=
''
;
$name
=
''
;
$slug
=
''
;
if
(
isset
(
$source
[
'tag_slug'
]))
{
// This is a tag
// This is a tag
.
$term_id
=
$source
[
'term_id'
]
??
'unknown'
;
$name
=
$source
[
'tag_name'
]
??
'unknown'
;
$slug
=
$source
[
'tag_slug'
]
??
'unknown'
;
}
elseif
(
isset
(
$source
[
'category_nicename'
]))
{
// This is a category
// This is a category
.
$term_id
=
$source
[
'term_id'
]
??
'unknown'
;
$name
=
$source
[
'cat_name'
]
??
'unknown'
;
$slug
=
$source
[
'category_nicename'
]
??
'unknown'
;
}
\Drupal
::
logger
(
'wordpress_migrate'
)
->
debug
(
'Processing term: Term ID=@id, Name=@name, Slug=@slug, Destination=@dest, Value=@value'
,
[
'@id'
=>
$term_id
,
'@name'
=>
$name
,
'@slug'
=>
$slug
,
'@dest'
=>
$destination_property
,
'@value'
=>
$value
,
]);
\Drupal
::
logger
(
'wordpress_migrate'
)
->
debug
(
'Processing term: Term ID=@id, Name=@name, Slug=@slug, Destination=@dest, Value=@value'
,
[
'@id'
=>
$term_id
,
'@name'
=>
$name
,
'@slug'
=>
$slug
,
'@dest'
=>
$destination_property
,
'@value'
=>
$value
,
]
);
return
$value
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment