> The option definitions. */ public function options(): array { return array( $this->url_option( __( 'Webhook address', 'devplugins-custom-form-builder' ), 'https://hook.eu2.make.com/…' ), ); } /** * Builds the body sent to the scenario. * * @param IntegrationContext $context Submission being delivered. * @param array $config Stored values for the form. * * @return array The payload. */ public function payload( IntegrationContext $context, array $config ): array { $fields = array(); foreach ( $context->fields() as $field ) { $key = $field->field_key(); $fields[] = array( 'key' => $key, 'label' => $field->label(), 'value' => $context->value( $key ), ); } return array( 'form' => array( 'id' => $context->form()->id(), 'title' => $context->form()->title(), ), 'submission' => array( 'id' => $context->submission_id(), 'submitted_at' => gmdate( 'c' ), 'entry_url' => $context->entry_url(), 'values' => $context->all(), 'fields' => $fields, ), ); } }