Sets of tasks can be used by the importer to build up a Wordpress post from a CultureHosts record.
-
CultureHosts\WP\Importer\Service\Task
Located at culturehosts-importer/src/Service/Task.php
| Methods |
public
|
run(Record $remote_record, array &$local_record, string $when): boolean
The importer calls this method for each record being imported.
The importer calls this method for each record being imported.
Parameters
| $remote_record |
The record as received from the CultureHosts API
|
| $local_record |
The post details, in the format accepted by wp_insert_post.
If $when is before_create or before_update, the task can modify this variable directly
and the results will be saved. For after_create or after_update, you should just use this
variable as a reference, e.g. by grabbing the $local_record['ID'].
|
| $when |
The relevant event, e.g. before_create, after_create, before_update...
|
Returns
Whether the task succeeded
Implemented by
|
#
|
public
|
supports_when(string $when): boolean
Allows the importer to check whether a task supports the event that's currently running.
Allows the importer to check whether a task supports the event that's currently running.
Parameters
| $when |
The event being checked, i.e. before_create, after_create,
before_update or after_update.
|
Returns
Whether the event is supported
Implemented by
|
#
|