Preflight
public function preflight(Mail $mail) : void
Fires before applying the action.
Description
This method can be used to perform some stuff before finalizing the application of the action. Just to make a practical example, the native Body action uses the preflight
method to collect all the created texts and group them within the supported positions.
The actions of a conditional text are applied only in case all the assigned filters (if any) are eligible.
In case the class extends the ConditionalTextActionAware
abstraction, it is possible to use the code below to access the configuration of the action.
$this->options->get('param', false);
Where the first argument is the name of the setting defined by the getForm()
method and the second one is the default value to use in case of no stored setting.
Bear in mind that the preflight and the apply method are not executed simultaneously. This means that, if you want to register some properties to reuse them in the apply
method, they should be declared with the static
modifier.
Parameters
-
(Mail) The mail instance where the changes can be applied. For further details about the methods supported by this object, you can take a look at the "Before Send" article under the See Also section.
Return Value
None.
Example
/**
* @inheritDoc
*
* IMPORTANT: you first need to load the E4J\VikRestaurants\Mail\Mail object accordingly
*/
public function preflight(Mail $mail)
{
// do some stuff here
}