Formats one or more field values from the remote record and saves them somewhere
Located at culturehosts-importer/src/Service/Tasks/Generic_Field_Task.php
| Methods |
public
|
__construct(string|string[] $source_fields, array|Formatter|callable $formatters = [])
Set the source fields and formatters for this task.
Set the source fields and formatters for this task.
Parameters
| $source_fields |
Field names as found in the CultureHosts record
|
| $formatters |
The formatters to pass the field values through
|
Overridden by
|
#
|
public
|
run(Record $remote_record, array &$local_record, string $when): boolean
The importer calls this method for each record being imported.
Fetches the relevant field value(s), Runs the formatter(s) on them, and then delegates
to the save() method.
The importer calls this method for each record being imported.
Fetches the relevant field value(s), Runs the formatter(s) on them, and then delegates
to the save() method.
Parameters
| $remote_record |
The record as received from the CultureHosts API
|
| $local_record |
The post details, in the format accepted by wp_insert_post.
|
| $when |
The relevant event, e.g. before_create, after_create, before_update...
|
Returns
Whether the task succeeded
Implements
|
#
|
public
|
supports_when(string $when): boolean
Supports all events by default. Might be overridden by subclass.
Supports all events by default. Might be overridden by subclass.
Parameters
| $when |
The event to check we're valid for.
|
Returns
Implements
|
#
|