Migrate Process Negate
18 sites
Security covered
This plugin negates a value, allowing you to migrate data by inverting its meaning. For example, you can use it to unpublish content when the source indicates it's deleted.
This is a simple migrate process plugin whose only purpose is to negate whatever value is sent over to it.
This is useful for situations where we want to save the opposite of what the source is.
For example, if our source content has a bool value of is_deleted, which roughly translates to Drupal's status (published) field, we actually want the content to be unpublished (0 or FALSE) when the source is marked as deleted (1 or TRUE).
Then all we'd need to do is:
...
process:
status:
plugin: negate
source: is_deleted
...
And it would work as expected.