FormBuilderProcessor::postAction2Ready() method

Called right before we send a duplicate copy to another URL

  • You can hook BEFORE this to modify the arguments before they are used in the HTTP request.
  • You can hook AFTER this to analyze or modify the returned response.

This protected method is for hooks to monitor and it is likely not intended to be called directly.

Internal usage

$bool = $processor->postAction2Ready(WireHttp $http, array $data, string $method, string $url, array $headers);

Arguments

NameType(s)Description
$httpWireHttp
$dataarray

Array of data that is being sent

$methodstring

Send method of either "get" or "post"

$urlstring

URL that data is being sent to

$headersarray

Additional HTTP headers to include in the request

Return value

bool string

Returns response string on success or boolean false on fail


Hooking $processor→postAction2Ready(…)

You can add your own hook events that are executed either before or after the $processor->postAction2Ready(…) method is executed. Examples of both are included below. A good place for hook code such as this is in your /site/ready.php file.

Hooking before

The 'before' hooks are called immediately before each $processor->postAction2Ready(…) method call is executed. This type of hook is especially useful for modifying arguments before they are sent to the method.

$this->addHookBefore('FormBuilderProcessor::postAction2Ready', function(HookEvent $event) {
  // Get the object the event occurred on, if needed
  $FormBuilderProcessor = $event->object;

  // Get values of arguments sent to hook (and optionally modify them)
  $http = $event->arguments(0);
  $data = $event->arguments(1);
  $method = $event->arguments(2);
  $url = $event->arguments(3);
  $headers = $event->arguments(4);

  /* Your code here, perhaps modifying arguments */

  // Populate back arguments (if you have modified them)
  $event->arguments(0, $http);
  $event->arguments(1, $data);
  $event->arguments(2, $method);
  $event->arguments(3, $url);
  $event->arguments(4, $headers);
});

Hooking after

The 'after' hooks are called immediately after each $processor->postAction2Ready(…) method call is executed. This type of hook is especially useful for modifying the value that was returned by the method call.

$this->addHookAfter('FormBuilderProcessor::postAction2Ready', function(HookEvent $event) {
  // Get the object the event occurred on, if needed
  $FormBuilderProcessor = $event->object;

  // An 'after' hook can retrieve and/or modify the return value
  $return = $event->return;

  // Get values of arguments sent to hook (if needed)
  $http = $event->arguments(0);
  $data = $event->arguments(1);
  $method = $event->arguments(2);
  $url = $event->arguments(3);
  $headers = $event->arguments(4);

  /* Your code here, perhaps modifying the return value */

  // Populate back return value, if you have modified it
  $event->return = $return;
});

$processor methods and properties

API reference based on ProcessWire core version 3.0.251