Migrate Conditions: Condition Plugins

Migrate Conditions defines a MigrateConditionsConditionPlugin that we will refer to as conditions in this guide. These conditions are only useful when leveraged by process plugins. As such, all examples will be in the context of a process plugin. We begin with some (mostly) universal aspects of conditions.

Negation

All condition plugins can be negated in two ways.

  1. Set negate: true in the configuration
  2. Prefix the plugin id with not:

Source

All conditions can be configured with a source property just like the source property on a process plugin. If the source is not specified for a condition, the condition "inherits" the source from whatever plugin is using the condition (usually a process plugin).

All Elements

all_elements allows special handling of arrays

And Condition

and allows conditions to be composed

Callback

callback can do more than you need it to do

Contains

contains works on strings or arrays

Default

The default condition is always true and most useful with switch_on_condition

Empty

empty returns true if the source value is empty

Entity Exists

entity_exists assumes the source is an entity id and figures out if the entity exists

Equals

equals compares a source value to another value

Greater Than

greater_than compares the source value to another value

HTTP Status

http_status can check a url before you try to process its contents

Has Element

has_element allows special handling of arrays

In Array

in_array evaluates whether the source value is in a configured array

In Migrate Map

in_migrate_map checks for a source in configured migrate maps

Is Null

is_null returns true if the source is null

Is Stub

is_stub returns true if the current row is a stub

Isset

isset returns true if the source isset

Less Than

less_than compares the source value to another value

Matches

check if a source string matches a regex pattern

Older Than

older_than compares a source date to another date

Or Condition

or allows conditions to be composed

Guide maintainers

danflanagan8's picture