Skip to content
Snippets Groups Projects
Commit 529ba481 authored by Christian Wach's avatar Christian Wach :soccer:
Browse files

Align docblock internals

parent 0fd26c01
No related branches found
No related tags found
No related merge requests found
...@@ -150,7 +150,7 @@ class CFAFA_Form_Action_Base { ...@@ -150,7 +150,7 @@ class CFAFA_Form_Action_Base {
// Get some Form details. // Get some Form details.
$form_name = acf_maybe_get( $form, 'name' ); $form_name = acf_maybe_get( $form, 'name' );
$form_id = acf_maybe_get( $form, 'ID' ); $form_id = acf_maybe_get( $form, 'ID' );
// Assume we're good to go. // Assume we're good to go.
$prepare = true; $prepare = true;
...@@ -167,7 +167,7 @@ class CFAFA_Form_Action_Base { ...@@ -167,7 +167,7 @@ class CFAFA_Form_Action_Base {
* @param integer $current_post_id The ID of the Post from which the Form has been submitted. * @param integer $current_post_id The ID of the Post from which the Form has been submitted.
* @param string $action The customised name of the Form Action. * @param string $action The customised name of the Form Action.
*/ */
$filter = 'acfe/form/prepare/' . $this->action_name; $filter = 'acfe/form/prepare/' . $this->action_name;
$prepare = apply_filters( $filter, $prepare, $form, $current_post_id, $action ); $prepare = apply_filters( $filter, $prepare, $form, $current_post_id, $action );
$prepare = apply_filters( $filter . '/form=' . $form_name, $prepare, $form, $current_post_id, $action ); $prepare = apply_filters( $filter . '/form=' . $form_name, $prepare, $form, $current_post_id, $action );
if ( ! empty( $action ) ) { if ( ! empty( $action ) ) {
...@@ -220,12 +220,12 @@ class CFAFA_Form_Action_Base { ...@@ -220,12 +220,12 @@ class CFAFA_Form_Action_Base {
// Init our layout. // Init our layout.
$layout = [ $layout = [
'key' => 'layout_' . $this->action_name, 'key' => 'layout_' . $this->action_name,
'name' => $this->action_name, 'name' => $this->action_name,
'label' => $this->action_label, 'label' => $this->action_label,
'display' => 'row', 'display' => 'row',
'min' => '', 'min' => '',
'max' => '', 'max' => '',
]; ];
// Build Action Tab. // Build Action Tab.
...@@ -281,45 +281,45 @@ class CFAFA_Form_Action_Base { ...@@ -281,45 +281,45 @@ class CFAFA_Form_Action_Base {
// "Action" Tab wrapper. // "Action" Tab wrapper.
$fields[] = [ $fields[] = [
'key' => $this->field_key . 'tab_action', 'key' => $this->field_key . 'tab_action',
'label' => __( 'Action', 'conditional-form-actions-for-acfe' ), 'label' => __( 'Action', 'conditional-form-actions-for-acfe' ),
'name' => '', 'name' => '',
'type' => 'tab', 'type' => 'tab',
'instructions' => '', 'instructions' => '',
'required' => 0, 'required' => 0,
'conditional_logic' => 0, 'conditional_logic' => 0,
'wrapper' => [ 'wrapper' => [
'width' => '', 'width' => '',
'class' => '', 'class' => '',
'id' => '', 'id' => '',
'data-no-preference' => true, 'data-no-preference' => true,
], ],
'acfe_permissions' => '', 'acfe_permissions' => '',
'placement' => 'top', 'placement' => 'top',
'endpoint' => 0, 'endpoint' => 0,
]; ];
// "Action name" Field. // "Action name" Field.
$fields[] = [ $fields[] = [
'key' => $this->field_key . 'custom_alias', 'key' => $this->field_key . 'custom_alias',
'label' => __( 'Action name', 'conditional-form-actions-for-acfe' ), 'label' => __( 'Action name', 'conditional-form-actions-for-acfe' ),
'name' => 'acfe_form_custom_alias', 'name' => 'acfe_form_custom_alias',
'type' => 'acfe_slug', 'type' => 'acfe_slug',
'instructions' => __( '(Required) Name this action so it can be referenced.', 'conditional-form-actions-for-acfe' ), 'instructions' => __( '(Required) Name this action so it can be referenced.', 'conditional-form-actions-for-acfe' ),
'required' => 1, 'required' => 1,
'conditional_logic' => 0, 'conditional_logic' => 0,
'wrapper' => [ 'wrapper' => [
'width' => '', 'width' => '',
'class' => '', 'class' => '',
'id' => '', 'id' => '',
'data-instruction-placement' => 'field', 'data-instruction-placement' => 'field',
], ],
'acfe_permissions' => '', 'acfe_permissions' => '',
'default_value' => '', 'default_value' => '',
'placeholder' => $this->alias_placeholder, 'placeholder' => $this->alias_placeholder,
'prepend' => '', 'prepend' => '',
'append' => '', 'append' => '',
'maxlength' => '', 'maxlength' => '',
]; ];
// Add any further Fields. // Add any further Fields.
...@@ -378,22 +378,22 @@ class CFAFA_Form_Action_Base { ...@@ -378,22 +378,22 @@ class CFAFA_Form_Action_Base {
// "Mapping" Tab wrapper. // "Mapping" Tab wrapper.
$mapping_tab = [ $mapping_tab = [
[ [
'key' => $this->field_key . 'tab_load', 'key' => $this->field_key . 'tab_load',
'label' => $label, 'label' => $label,
'name' => '', 'name' => '',
'type' => 'tab', 'type' => 'tab',
'instructions' => '', 'instructions' => '',
'required' => 0, 'required' => 0,
'conditional_logic' => 0, 'conditional_logic' => 0,
'wrapper' => [ 'wrapper' => [
'width' => '', 'width' => '',
'class' => '', 'class' => '',
'id' => '', 'id' => '',
'data-no-preference' => true, 'data-no-preference' => true,
], ],
'acfe_permissions' => '', 'acfe_permissions' => '',
'placement' => 'top', 'placement' => 'top',
'endpoint' => 0, 'endpoint' => 0,
], ],
]; ];
...@@ -431,22 +431,22 @@ class CFAFA_Form_Action_Base { ...@@ -431,22 +431,22 @@ class CFAFA_Form_Action_Base {
// "Attachments" Tab wrapper. // "Attachments" Tab wrapper.
$attachments_tab = [ $attachments_tab = [
[ [
'key' => $this->field_key . 'tab_attachments', 'key' => $this->field_key . 'tab_attachments',
'label' => __( 'Attachments', 'conditional-form-actions-for-acfe' ), 'label' => __( 'Attachments', 'conditional-form-actions-for-acfe' ),
'name' => '', 'name' => '',
'type' => 'tab', 'type' => 'tab',
'instructions' => '', 'instructions' => '',
'required' => 0, 'required' => 0,
'conditional_logic' => 0, 'conditional_logic' => 0,
'wrapper' => [ 'wrapper' => [
'width' => '', 'width' => '',
'class' => '', 'class' => '',
'id' => '', 'id' => '',
'data-no-preference' => true, 'data-no-preference' => true,
], ],
'acfe_permissions' => '', 'acfe_permissions' => '',
'placement' => 'top', 'placement' => 'top',
'endpoint' => 0, 'endpoint' => 0,
], ],
]; ];
...@@ -474,28 +474,28 @@ class CFAFA_Form_Action_Base { ...@@ -474,28 +474,28 @@ class CFAFA_Form_Action_Base {
// Build the Field array. // Build the Field array.
$field = [ $field = [
'key' => $this->field_key . 'map_' . $code, 'key' => $this->field_key . 'map_' . $code,
'label' => $label, 'label' => $label,
'name' => $this->field_name . 'map_' . $code, 'name' => $this->field_name . 'map_' . $code,
'type' => 'select', 'type' => 'select',
'instructions' => '', 'instructions' => '',
'required' => 0, 'required' => 0,
'wrapper' => [ 'wrapper' => [
'width' => '', 'width' => '',
'class' => '', 'class' => '',
'id' => '', 'id' => '',
], ],
'acfe_permissions' => '', 'acfe_permissions' => '',
'choices' => [], 'choices' => [],
'default_value' => [], 'default_value' => [],
'allow_null' => 1, 'allow_null' => 1,
'multiple' => 0, 'multiple' => 0,
'ui' => 1, 'ui' => 1,
'return_format' => 'value', 'return_format' => 'value',
'placeholder' => __( 'Default', 'conditional-form-actions-for-acfe' ), 'placeholder' => __( 'Default', 'conditional-form-actions-for-acfe' ),
'ajax' => 0, 'ajax' => 0,
'search_placeholder' => __( 'Enter a custom value or template tag. (See "Cheatsheet" tab)', 'conditional-form-actions-for-acfe' ), 'search_placeholder' => __( 'Enter a custom value or template tag. (See "Cheatsheet" tab)', 'conditional-form-actions-for-acfe' ),
'allow_custom' => 1, 'allow_custom' => 1,
]; ];
// Default conditional logic. // Default conditional logic.
......
...@@ -84,7 +84,7 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -84,7 +84,7 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
// Store references to objects. // Store references to objects.
$this->plugin = $parent->plugin; $this->plugin = $parent->plugin;
$this->acfe = $parent; $this->acfe = $parent;
// Label this Form Action. // Label this Form Action.
$this->action_label = __( 'Conditional Email action', 'conditional-form-actions-for-acfe' ); $this->action_label = __( 'Conditional Email action', 'conditional-form-actions-for-acfe' );
...@@ -106,15 +106,15 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -106,15 +106,15 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
// Declare the mapped Email Fields with translatable titles. // Declare the mapped Email Fields with translatable titles.
$this->mapped_email_fields = [ $this->mapped_email_fields = [
'from_name' => __( 'From Name', 'conditional-form-actions-for-acfe' ), 'from_name' => __( 'From Name', 'conditional-form-actions-for-acfe' ),
'from_email' => __( 'From Email', 'conditional-form-actions-for-acfe' ), 'from_email' => __( 'From Email', 'conditional-form-actions-for-acfe' ),
'reply_to_name' => __( 'Reply To Name', 'conditional-form-actions-for-acfe' ), 'reply_to_name' => __( 'Reply To Name', 'conditional-form-actions-for-acfe' ),
'reply_to_email' => __( 'Reply To Email', 'conditional-form-actions-for-acfe' ), 'reply_to_email' => __( 'Reply To Email', 'conditional-form-actions-for-acfe' ),
'to_name' => __( 'To Name', 'conditional-form-actions-for-acfe' ), 'to_name' => __( 'To Name', 'conditional-form-actions-for-acfe' ),
'to_email' => __( 'To Email', 'conditional-form-actions-for-acfe' ), 'to_email' => __( 'To Email', 'conditional-form-actions-for-acfe' ),
'cc' => __( 'Cc', 'conditional-form-actions-for-acfe' ), 'cc' => __( 'Cc', 'conditional-form-actions-for-acfe' ),
'bcc' => __( 'Bcc', 'conditional-form-actions-for-acfe' ), 'bcc' => __( 'Bcc', 'conditional-form-actions-for-acfe' ),
'subject' => __( 'Subject', 'conditional-form-actions-for-acfe' ), 'subject' => __( 'Subject', 'conditional-form-actions-for-acfe' ),
]; ];
// Populate mapping Fields. // Populate mapping Fields.
...@@ -168,7 +168,7 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -168,7 +168,7 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
// Get some Form details. // Get some Form details.
$form_name = acf_maybe_get( $form, 'name' ); $form_name = acf_maybe_get( $form, 'name' );
$form_id = acf_maybe_get( $form, 'ID' ); $form_id = acf_maybe_get( $form, 'ID' );
// Populate Email data array. // Populate Email data array.
$email = $this->form_email_data( $form, $current_post_id, $action ); $email = $this->form_email_data( $form, $current_post_id, $action );
...@@ -212,12 +212,12 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -212,12 +212,12 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
$fields = []; $fields = [];
// Add Conditional Field. // Add Conditional Field.
$code = 'email_conditional'; $code = 'email_conditional';
$label = __( 'Conditional On', 'conditional-form-actions-for-acfe' ); $label = __( 'Conditional On', 'conditional-form-actions-for-acfe' );
$conditional = $this->mapping_field_get( $code, $label ); $conditional = $this->mapping_field_get( $code, $label );
$conditional['placeholder'] = __( 'Always send', 'conditional-form-actions-for-acfe' ); $conditional['placeholder'] = __( 'Always send', 'conditional-form-actions-for-acfe' );
$conditional['wrapper']['data-instruction-placement'] = 'field'; $conditional['wrapper']['data-instruction-placement'] = 'field';
$conditional['instructions'] = __( 'To send the Email only when a Form Field is populated (e.g. "First Name") link this to the Form Field. To send the Email only when more complex conditions are met, link this to a Hidden Field with value "1" where the conditional logic of that Field shows it when the conditions are met.', 'conditional-form-actions-for-acfe' ); $conditional['instructions'] = __( 'To send the Email only when a Form Field is populated (e.g. "First Name") link this to the Form Field. To send the Email only when more complex conditions are met, link this to a Hidden Field with value "1" where the conditional logic of that Field shows it when the conditions are met.', 'conditional-form-actions-for-acfe' );
$fields[] = $conditional; $fields[] = $conditional;
// --< // --<
...@@ -235,7 +235,7 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -235,7 +235,7 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
public function tab_mapping_add() { public function tab_mapping_add() {
// Get Tab Header. // Get Tab Header.
$label = __( 'Email', 'conditional-form-actions-for-acfe' ); $label = __( 'Email', 'conditional-form-actions-for-acfe' );
$mapping_tab_header = $this->tab_mapping_header( $label ); $mapping_tab_header = $this->tab_mapping_header( $label );
// Build Email Details Accordion. // Build Email Details Accordion.
...@@ -271,32 +271,32 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -271,32 +271,32 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
// Add Content Field. // Add Content Field.
$fields[] = [ $fields[] = [
'key' => $this->field_key . 'content', 'key' => $this->field_key . 'content',
'label' => __( 'Content', 'conditional-form-actions-for-acfe' ), 'label' => __( 'Content', 'conditional-form-actions-for-acfe' ),
'name' => $this->field_name . 'content', 'name' => $this->field_name . 'content',
'type' => 'wysiwyg', 'type' => 'wysiwyg',
'instructions' => sprintf( 'instructions' => sprintf(
/* translators: 1: Opening code tag, 2: Closing code tag, 3: Line break tag. */ /* translators: 1: Opening code tag, 2: Closing code tag, 3: Line break tag. */
__( 'Fields values may be included using %1$s{field:field_key}%2$s %1$s{field:title}%2$s. All fields may be included using %1$s{fields}%2$s.%3$sSee "Cheatsheet" tab for advanced usage.', 'conditional-form-actions-for-acfe' ), __( 'Fields values may be included using %1$s{field:field_key}%2$s %1$s{field:title}%2$s. All fields may be included using %1$s{fields}%2$s.%3$sSee "Cheatsheet" tab for advanced usage.', 'conditional-form-actions-for-acfe' ),
'<code>', '<code>',
'</code>', '</code>',
'<br />' '<br />'
), ),
'required' => 0, 'required' => 0,
'conditional_logic' => 0, 'conditional_logic' => 0,
'wrapper' => [ 'wrapper' => [
'width' => '', 'width' => '',
'class' => '', 'class' => '',
'id' => '', 'id' => '',
'data-instruction-placement' => 'field', 'data-instruction-placement' => 'field',
], ],
'acfe_permissions' => '', 'acfe_permissions' => '',
'default_value' => '', 'default_value' => '',
'tabs' => 'all', 'tabs' => 'all',
'toolbar' => 'full', 'toolbar' => 'full',
'media_upload' => 1, 'media_upload' => 1,
'delay' => 0, 'delay' => 0,
'endpoint' => 1, 'endpoint' => 1,
]; ];
// --< // --<
...@@ -318,110 +318,110 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -318,110 +318,110 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
// Add "Dynamic Files" Repeater. // Add "Dynamic Files" Repeater.
$attachments_tab[] = [ $attachments_tab[] = [
'key' => $this->field_key . 'files', 'key' => $this->field_key . 'files',
'label' => __( 'Dynamic Files', 'conditional-form-actions-for-acfe' ), 'label' => __( 'Dynamic Files', 'conditional-form-actions-for-acfe' ),
'name' => $this->field_name . 'files', 'name' => $this->field_name . 'files',
'type' => 'repeater', 'type' => 'repeater',
'instructions' => '', 'instructions' => '',
'required' => 0, 'required' => 0,
'conditional_logic' => 0, 'conditional_logic' => 0,
'wrapper' => [ 'wrapper' => [
'width' => '', 'width' => '',
'class' => '', 'class' => '',
'id' => '', 'id' => '',
], ],
'acfe_permissions' => '', 'acfe_permissions' => '',
'acfe_repeater_stylised_button' => 0, 'acfe_repeater_stylised_button' => 0,
'collapsed' => '', 'collapsed' => '',
'min' => 0, 'min' => 0,
'max' => 0, 'max' => 0,
'layout' => 'table', 'layout' => 'table',
'button_label' => __( 'Add File', 'conditional-form-actions-for-acfe' ), 'button_label' => __( 'Add File', 'conditional-form-actions-for-acfe' ),
'sub_fields' => [ 'sub_fields' => [
[ [
'key' => $this->field_key . 'file', 'key' => $this->field_key . 'file',
'label' => __( 'File', 'conditional-form-actions-for-acfe' ), 'label' => __( 'File', 'conditional-form-actions-for-acfe' ),
'name' => $this->field_name . 'file', 'name' => $this->field_name . 'file',
'type' => 'select', 'type' => 'select',
'instructions' => '', 'instructions' => '',
'required' => 0, 'required' => 0,
'conditional_logic' => 0, 'conditional_logic' => 0,
'wrapper' => [ 'wrapper' => [
'width' => '', 'width' => '',
'class' => '', 'class' => '',
'id' => '', 'id' => '',
], ],
'acfe_permissions' => '', 'acfe_permissions' => '',
'choices' => [], 'choices' => [],
'default_value' => [], 'default_value' => [],
'allow_null' => 0, 'allow_null' => 0,
'multiple' => 0, 'multiple' => 0,
'ui' => 1, 'ui' => 1,
'return_format' => 'value', 'return_format' => 'value',
'ajax' => 0, 'ajax' => 0,
'placeholder' => '', 'placeholder' => '',
'search_placeholder' => __( 'Enter a custom value or template tag. (See "Cheatsheet" tab)', 'conditional-form-actions-for-acfe' ), 'search_placeholder' => __( 'Enter a custom value or template tag. (See "Cheatsheet" tab)', 'conditional-form-actions-for-acfe' ),
'allow_custom' => 1, 'allow_custom' => 1,
], ],
[ [
'key' => $this->field_key . 'file_delete', 'key' => $this->field_key . 'file_delete',
'label' => __( 'Delete File', 'conditional-form-actions-for-acfe' ), 'label' => __( 'Delete File', 'conditional-form-actions-for-acfe' ),
'name' => $this->field_name . 'file_delete', 'name' => $this->field_name . 'file_delete',
'type' => 'true_false', 'type' => 'true_false',
'instructions' => '', 'instructions' => '',
'required' => 0, 'required' => 0,
'wrapper' => [ 'wrapper' => [
'width' => '', 'width' => '',
'class' => '', 'class' => '',
'id' => '', 'id' => '',
], ],
'acfe_permissions' => '', 'acfe_permissions' => '',
'message' => __( 'Delete once submitted', 'conditional-form-actions-for-acfe' ), 'message' => __( 'Delete once submitted', 'conditional-form-actions-for-acfe' ),
'default_value' => 0, 'default_value' => 0,
'ui' => 1, 'ui' => 1,
'ui_on_text' => '', 'ui_on_text' => '',
'ui_off_text' => '', 'ui_off_text' => '',
], ],
], ],
]; ];
// Add "Static Files" Repeater. // Add "Static Files" Repeater.
$attachments_tab[] = [ $attachments_tab[] = [
'key' => $this->field_key . 'files_static', 'key' => $this->field_key . 'files_static',
'label' => __( 'Static Files', 'conditional-form-actions-for-acfe' ), 'label' => __( 'Static Files', 'conditional-form-actions-for-acfe' ),
'name' => $this->field_name . 'files_static', 'name' => $this->field_name . 'files_static',
'type' => 'repeater', 'type' => 'repeater',
'instructions' => '', 'instructions' => '',
'required' => 0, 'required' => 0,
'conditional_logic' => 0, 'conditional_logic' => 0,
'wrapper' => [ 'wrapper' => [
'width' => '', 'width' => '',
'class' => '', 'class' => '',
'id' => '', 'id' => '',
], ],
'acfe_permissions' => '', 'acfe_permissions' => '',
'acfe_repeater_stylised_button' => 0, 'acfe_repeater_stylised_button' => 0,
'collapsed' => '', 'collapsed' => '',
'min' => 0, 'min' => 0,
'max' => 0, 'max' => 0,
'layout' => 'table', 'layout' => 'table',
'button_label' => __( 'Add File', 'conditional-form-actions-for-acfe' ), 'button_label' => __( 'Add File', 'conditional-form-actions-for-acfe' ),
'sub_fields' => [ 'sub_fields' => [
[ [
'key' => $this->field_key . 'file_static', 'key' => $this->field_key . 'file_static',
'label' => __( 'File', 'conditional-form-actions-for-acfe' ), 'label' => __( 'File', 'conditional-form-actions-for-acfe' ),
'name' => $this->field_name . 'file_static', 'name' => $this->field_name . 'file_static',
'type' => 'file', 'type' => 'file',
'instructions' => '', 'instructions' => '',
'required' => 0, 'required' => 0,
'conditional_logic' => 0, 'conditional_logic' => 0,
'wrapper' => [ 'wrapper' => [
'width' => '', 'width' => '',
'class' => '', 'class' => '',
'id' => '', 'id' => '',
], ],
'acfe_permissions' => '', 'acfe_permissions' => '',
'return_format' => 'id', 'return_format' => 'id',
], ],
], ],
]; ];
...@@ -462,12 +462,12 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -462,12 +462,12 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
$data = acfe_form_map_vs_fields( $fields, $fields, $current_post_id, $form ); $data = acfe_form_map_vs_fields( $fields, $fields, $current_post_id, $form );
// Add Email Content. // Add Email Content.
$content = get_sub_field( $this->field_key . 'content' ); $content = get_sub_field( $this->field_key . 'content' );
$data['content'] = acfe_form_map_field_value( $content, $current_post_id, $form ); $data['content'] = acfe_form_map_field_value( $content, $current_post_id, $form );
// Get Email Conditional Reference. // Get Email Conditional Reference.
$data['email_conditional_ref'] = get_sub_field( $this->field_key . 'map_email_conditional' ); $data['email_conditional_ref'] = get_sub_field( $this->field_key . 'map_email_conditional' );
$conditionals = [ $data['email_conditional_ref'] ]; $conditionals = [ $data['email_conditional_ref'] ];
// Populate array with mapped Conditional Field values. // Populate array with mapped Conditional Field values.
$conditionals = acfe_form_map_vs_fields( $conditionals, $conditionals, $current_post_id, $form ); $conditionals = acfe_form_map_vs_fields( $conditionals, $conditionals, $current_post_id, $form );
...@@ -495,7 +495,7 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -495,7 +495,7 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
// Init return array. // Init return array.
$data = [ $data = [
'attachments' => [], 'attachments' => [],
'delete' => [], 'delete' => [],
]; ];
// Process Dynamic Attachments. // Process Dynamic Attachments.
...@@ -505,10 +505,10 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -505,10 +505,10 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
// Find the ID of the File. // Find the ID of the File.
$file_field_key = get_sub_field( $this->field_name . 'file' ); $file_field_key = get_sub_field( $this->field_name . 'file' );
$file_id = acfe_form_map_field_value( $file_field_key, $current_post_id, $form ); $file_id = acfe_form_map_field_value( $file_field_key, $current_post_id, $form );
// Configure the File Field to return an array. // Configure the File Field to return an array.
$field = acf_get_field( $file_field_key ); $field = acf_get_field( $file_field_key );
$field['return_format'] = 'array'; $field['return_format'] = 'array';
// Build an array of data for the Dynamic Attachments. // Build an array of data for the Dynamic Attachments.
...@@ -571,7 +571,7 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -571,7 +571,7 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
public function form_build_args( $email_data, $attachments_data, $form, $current_post_id, $action ) { public function form_build_args( $email_data, $attachments_data, $form, $current_post_id, $action ) {
// Build "From" and "Reply To" params. // Build "From" and "Reply To" params.
$from = $this->form_email_item_build( $email_data['from_name'], $email_data['from_email'] ); $from = $this->form_email_item_build( $email_data['from_name'], $email_data['from_email'] );
$reply_to = $this->form_email_item_build( $email_data['reply_to_name'], $email_data['reply_to_email'] ); $reply_to = $this->form_email_item_build( $email_data['reply_to_name'], $email_data['reply_to_email'] );
// Maybe use "From" when "Reply To" is empty. // Maybe use "From" when "Reply To" is empty.
...@@ -604,14 +604,14 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -604,14 +604,14 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
// Finally, build args array. // Finally, build args array.
$args = [ $args = [
'from' => $from, 'from' => $from,
'to' => $to, 'to' => $to,
'reply_to' => $reply_to, 'reply_to' => $reply_to,
'cc' => $email_data['cc'], 'cc' => $email_data['cc'],
'bcc' => $email_data['bcc'], 'bcc' => $email_data['bcc'],
'subject' => $email_data['subject'], 'subject' => $email_data['subject'],
'content' => $email_data['content'], 'content' => $email_data['content'],
'headers' => $headers, 'headers' => $headers,
'attachments' => $attachments_data['attachments'], 'attachments' => $attachments_data['attachments'],
]; ];
...@@ -631,8 +631,8 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -631,8 +631,8 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
* @param string $action The customised name of the Form Action. * @param string $action The customised name of the Form Action.
*/ */
$filter = 'acfe/form/submit/' . $this->action_name . '/email_args'; $filter = 'acfe/form/submit/' . $this->action_name . '/email_args';
$args = apply_filters( $filter, $args, $form, $current_post_id, $action ); $args = apply_filters( $filter, $args, $form, $current_post_id, $action );
$args = apply_filters( $filter . '/form=' . $form_name, $args, $form, $current_post_id, $action ); $args = apply_filters( $filter . '/form=' . $form_name, $args, $form, $current_post_id, $action );
if ( ! empty( $action ) ) { if ( ! empty( $action ) ) {
$args = apply_filters( $filter . '/action=' . $action, $args, $form, $current_post_id, $action ); $args = apply_filters( $filter . '/action=' . $action, $args, $form, $current_post_id, $action );
} }
...@@ -682,23 +682,23 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base { ...@@ -682,23 +682,23 @@ class CFAFA_Form_Action_Email extends CFAFA_Form_Action_Base {
// Define rules for checking Email headers. // Define rules for checking Email headers.
$rules = [ $rules = [
[ [
'args_key' => 'from', 'args_key' => 'from',
'value_old' => $this->form_email_item_build( $email_data['from_name'], $email_data['from_email'] ), 'value_old' => $this->form_email_item_build( $email_data['from_name'], $email_data['from_email'] ),
'header_key' => 'From:', 'header_key' => 'From:',
], ],
[ [
'args_key' => 'reply_to', 'args_key' => 'reply_to',
'value_old' => $this->form_email_item_build( $email_data['reply_to_name'], $email_data['reply_to_email'] ), 'value_old' => $this->form_email_item_build( $email_data['reply_to_name'], $email_data['reply_to_email'] ),
'header_key' => 'Reply-To:', 'header_key' => 'Reply-To:',
], ],
[ [
'args_key' => 'cc', 'args_key' => 'cc',
'value_old' => $email_data['cc'], 'value_old' => $email_data['cc'],
'header_key' => 'Cc:', 'header_key' => 'Cc:',
], ],
[ [
'args_key' => 'bcc', 'args_key' => 'bcc',
'value_old' => $email_data['bcc'], 'value_old' => $email_data['bcc'],
'header_key' => 'Bcc:', 'header_key' => 'Bcc:',
], ],
]; ];
......
...@@ -75,7 +75,7 @@ class CFAFA_Form_Action_Product extends CFAFA_Form_Action_Base { ...@@ -75,7 +75,7 @@ class CFAFA_Form_Action_Product extends CFAFA_Form_Action_Base {
// Store references to objects. // Store references to objects.
$this->plugin = $parent->plugin; $this->plugin = $parent->plugin;
$this->acfe = $parent; $this->acfe = $parent;
// Label this Form Action. // Label this Form Action.
$this->action_label = __( 'WooCommerce Product action', 'conditional-form-actions-for-acfe' ); $this->action_label = __( 'WooCommerce Product action', 'conditional-form-actions-for-acfe' );
...@@ -118,7 +118,7 @@ class CFAFA_Form_Action_Product extends CFAFA_Form_Action_Base { ...@@ -118,7 +118,7 @@ class CFAFA_Form_Action_Product extends CFAFA_Form_Action_Base {
// Get some Form details. // Get some Form details.
$form_name = acf_maybe_get( $form, 'name' ); $form_name = acf_maybe_get( $form, 'name' );
$form_id = acf_maybe_get( $form, 'ID' ); $form_id = acf_maybe_get( $form, 'ID' );
// Populate Product data array. // Populate Product data array.
$product_data = $this->form_product_data( $form, $current_post_id, $action ); $product_data = $this->form_product_data( $form, $current_post_id, $action );
...@@ -144,38 +144,38 @@ class CFAFA_Form_Action_Product extends CFAFA_Form_Action_Base { ...@@ -144,38 +144,38 @@ class CFAFA_Form_Action_Product extends CFAFA_Form_Action_Base {
$fields = []; $fields = [];
$fields[] = [ $fields[] = [
'key' => $this->field_key . 'product_id', 'key' => $this->field_key . 'product_id',
'label' => __( 'WooCommerce Product', 'conditional-form-actions-for-acfe' ), 'label' => __( 'WooCommerce Product', 'conditional-form-actions-for-acfe' ),
'name' => $this->field_name . 'product_id', 'name' => $this->field_name . 'product_id',
'type' => 'select', 'type' => 'select',
'instructions' => __( 'Use this to add a WooCommerce Product to the Cart.', 'conditional-form-actions-for-acfe' ), 'instructions' => __( 'Use this to add a WooCommerce Product to the Cart.', 'conditional-form-actions-for-acfe' ),
'required' => 0, 'required' => 0,
'conditional_logic' => 0, 'conditional_logic' => 0,
'wrapper' => [ 'wrapper' => [
'width' => '', 'width' => '',
'class' => '', 'class' => '',
'id' => '', 'id' => '',
'data-instruction-placement' => 'field', 'data-instruction-placement' => 'field',
], ],
'acfe_permissions' => '', 'acfe_permissions' => '',
'default_value' => '', 'default_value' => '',
'placeholder' => '', 'placeholder' => '',
'allow_null' => 1, 'allow_null' => 1,
'multiple' => 0, 'multiple' => 0,
'ui' => 0, 'ui' => 0,
// 'ajax' => 1, // 'ajax' => 1,
// 'ajax_action' => 'cfafa_get_products', // 'ajax_action' => 'cfafa_get_products',
'return_format' => 'value', 'return_format' => 'value',
'choices' => $this->product_choices_get(), 'choices' => $this->product_choices_get(),
]; ];
// Add Conditional Field. // Add Conditional Field.
$code = 'product_conditional'; $code = 'product_conditional';
$label = __( 'Conditional On', 'conditional-form-actions-for-acfe' ); $label = __( 'Conditional On', 'conditional-form-actions-for-acfe' );
$conditional = $this->mapping_field_get( $code, $label ); $conditional = $this->mapping_field_get( $code, $label );
$conditional['placeholder'] = __( 'Always add', 'conditional-form-actions-for-acfe' ); $conditional['placeholder'] = __( 'Always add', 'conditional-form-actions-for-acfe' );
$conditional['wrapper']['data-instruction-placement'] = 'field'; $conditional['wrapper']['data-instruction-placement'] = 'field';
$conditional['instructions'] = __( 'To add the Product to the Cart only when a Form Field is populated (e.g. "First Name") link this to the Form Field. To add the Product to the Cart only when more complex conditions are met, link this to a Hidden Field with value "1" where the conditional logic of that Field shows it when the conditions are met.', 'conditional-form-actions-for-acfe' ); $conditional['instructions'] = __( 'To add the Product to the Cart only when a Form Field is populated (e.g. "First Name") link this to the Form Field. To add the Product to the Cart only when more complex conditions are met, link this to a Hidden Field with value "1" where the conditional logic of that Field shows it when the conditions are met.', 'conditional-form-actions-for-acfe' );
$fields[] = $conditional; $fields[] = $conditional;
// --< // --<
...@@ -200,7 +200,7 @@ class CFAFA_Form_Action_Product extends CFAFA_Form_Action_Base { ...@@ -200,7 +200,7 @@ class CFAFA_Form_Action_Product extends CFAFA_Form_Action_Base {
// Get Product Conditional Reference. // Get Product Conditional Reference.
$data['product_conditional_ref'] = get_sub_field( $this->field_key . 'map_product_conditional' ); $data['product_conditional_ref'] = get_sub_field( $this->field_key . 'map_product_conditional' );
$conditionals = [ $data['product_conditional_ref'] ]; $conditionals = [ $data['product_conditional_ref'] ];
// Populate array with mapped Conditional Field values. // Populate array with mapped Conditional Field values.
$conditionals = acfe_form_map_vs_fields( $conditionals, $conditionals, $current_post_id, $form ); $conditionals = acfe_form_map_vs_fields( $conditionals, $conditionals, $current_post_id, $form );
...@@ -286,9 +286,9 @@ class CFAFA_Form_Action_Product extends CFAFA_Form_Action_Base { ...@@ -286,9 +286,9 @@ class CFAFA_Form_Action_Product extends CFAFA_Form_Action_Base {
* This may need to be looked at again in future. * This may need to be looked at again in future.
*/ */
$args = [ $args = [
'post_type' => 'product', 'post_type' => 'product',
'post_status' => [ 'publish' ], 'post_status' => [ 'publish' ],
'no_found_rows' => true, 'no_found_rows' => true,
'posts_per_page' => -1, 'posts_per_page' => -1,
]; ];
...@@ -329,10 +329,10 @@ class CFAFA_Form_Action_Product extends CFAFA_Form_Action_Base { ...@@ -329,10 +329,10 @@ class CFAFA_Form_Action_Product extends CFAFA_Form_Action_Base {
} }
// Some defaults. // Some defaults.
$product_id = $product->get_id(); $product_id = $product->get_id();
$quantity = 1; $quantity = 1;
$variation_id = 0; $variation_id = 0;
$variation = []; $variation = [];
$cart_item_data = []; $cart_item_data = [];
// Build Cart Item data? // Build Cart Item data?
......
...@@ -75,7 +75,7 @@ class CFAFA_Form_Action_Redirect extends CFAFA_Form_Action_Base { ...@@ -75,7 +75,7 @@ class CFAFA_Form_Action_Redirect extends CFAFA_Form_Action_Base {
// Store references to objects. // Store references to objects.
$this->plugin = $parent->plugin; $this->plugin = $parent->plugin;
$this->acfe = $parent; $this->acfe = $parent;
// Label this Form Action. // Label this Form Action.
$this->action_label = __( 'Conditional Redirect action', 'conditional-form-actions-for-acfe' ); $this->action_label = __( 'Conditional Redirect action', 'conditional-form-actions-for-acfe' );
...@@ -141,34 +141,34 @@ class CFAFA_Form_Action_Redirect extends CFAFA_Form_Action_Base { ...@@ -141,34 +141,34 @@ class CFAFA_Form_Action_Redirect extends CFAFA_Form_Action_Base {
// Add URL Field. // Add URL Field.
$fields[] = [ $fields[] = [
'key' => $this->field_key . 'redirect_url', 'key' => $this->field_key . 'redirect_url',
'label' => __( 'Redirect URL', 'conditional-form-actions-for-acfe' ), 'label' => __( 'Redirect URL', 'conditional-form-actions-for-acfe' ),
'name' => $this->field_name . 'redirect_url', 'name' => $this->field_name . 'redirect_url',
'type' => 'text', 'type' => 'text',
'instructions' => __( 'The URL to redirect to. See "Cheatsheet" tab for all available template tags.', 'conditional-form-actions-for-acfe' ), 'instructions' => __( 'The URL to redirect to. See "Cheatsheet" tab for all available template tags.', 'conditional-form-actions-for-acfe' ),
'required' => 0, 'required' => 0,
'conditional_logic' => 0, 'conditional_logic' => 0,
'wrapper' => [ 'wrapper' => [
'width' => '', 'width' => '',
'class' => '', 'class' => '',
'id' => '', 'id' => '',
'data-instruction-placement' => 'field', 'data-instruction-placement' => 'field',
], ],
'acfe_permissions' => '', 'acfe_permissions' => '',
'default_value' => '', 'default_value' => '',
'placeholder' => '', 'placeholder' => '',
'prepend' => '', 'prepend' => '',
'append' => '', 'append' => '',
'maxlength' => '', 'maxlength' => '',
]; ];
// Add Conditional Field. // Add Conditional Field.
$code = 'redirect_conditional'; $code = 'redirect_conditional';
$label = __( 'Conditional On', 'conditional-form-actions-for-acfe' ); $label = __( 'Conditional On', 'conditional-form-actions-for-acfe' );
$conditional = $this->mapping_field_get( $code, $label ); $conditional = $this->mapping_field_get( $code, $label );
$conditional['placeholder'] = __( 'Always redirect', 'conditional-form-actions-for-acfe' ); $conditional['placeholder'] = __( 'Always redirect', 'conditional-form-actions-for-acfe' );
$conditional['wrapper']['data-instruction-placement'] = 'field'; $conditional['wrapper']['data-instruction-placement'] = 'field';
$conditional['instructions'] = __( 'To redirect only when a Form Field is populated, link this to the Form Field. To redirect only when more complex conditions are met, link this to a Hidden Field with value "1" where the conditional logic of that Field shows it when the conditions are met.', 'conditional-form-actions-for-acfe' ); $conditional['instructions'] = __( 'To redirect only when a Form Field is populated, link this to the Form Field. To redirect only when more complex conditions are met, link this to a Hidden Field with value "1" where the conditional logic of that Field shows it when the conditions are met.', 'conditional-form-actions-for-acfe' );
$fields[] = $conditional; $fields[] = $conditional;
// --< // --<
...@@ -190,7 +190,7 @@ class CFAFA_Form_Action_Redirect extends CFAFA_Form_Action_Base { ...@@ -190,7 +190,7 @@ class CFAFA_Form_Action_Redirect extends CFAFA_Form_Action_Base {
// Get some Form details. // Get some Form details.
$form_name = acf_maybe_get( $form, 'name' ); $form_name = acf_maybe_get( $form, 'name' );
$form_id = acf_maybe_get( $form, 'ID' ); $form_id = acf_maybe_get( $form, 'ID' );
// Init data array. // Init data array.
$data = []; $data = [];
...@@ -210,8 +210,8 @@ class CFAFA_Form_Action_Redirect extends CFAFA_Form_Action_Base { ...@@ -210,8 +210,8 @@ class CFAFA_Form_Action_Redirect extends CFAFA_Form_Action_Base {
* @param string $action The customised name of the Form Action. * @param string $action The customised name of the Form Action.
*/ */
$filter = 'acfe/form/submit/' . $this->action_name . '/url'; $filter = 'acfe/form/submit/' . $this->action_name . '/url';
$url = apply_filters( $filter, $url, $form, $current_post_id, $action ); $url = apply_filters( $filter, $url, $form, $current_post_id, $action );
$url = apply_filters( $filter . '/form=' . $form_name, $url, $form, $current_post_id, $action ); $url = apply_filters( $filter . '/form=' . $form_name, $url, $form, $current_post_id, $action );
if ( ! empty( $action ) ) { if ( ! empty( $action ) ) {
$url = apply_filters( $filter . '/action=' . $action, $url, $form, $current_post_id, $action ); $url = apply_filters( $filter . '/action=' . $action, $url, $form, $current_post_id, $action );
} }
...@@ -221,7 +221,7 @@ class CFAFA_Form_Action_Redirect extends CFAFA_Form_Action_Base { ...@@ -221,7 +221,7 @@ class CFAFA_Form_Action_Redirect extends CFAFA_Form_Action_Base {
// Get Redirect Conditional Reference. // Get Redirect Conditional Reference.
$data['redirect_conditional_ref'] = get_sub_field( $this->field_key . 'map_redirect_conditional' ); $data['redirect_conditional_ref'] = get_sub_field( $this->field_key . 'map_redirect_conditional' );
$conditionals = [ $data['redirect_conditional_ref'] ]; $conditionals = [ $data['redirect_conditional_ref'] ];
// Populate array with mapped Conditional Field values. // Populate array with mapped Conditional Field values.
$conditionals = acfe_form_map_vs_fields( $conditionals, $conditionals, $current_post_id, $form ); $conditionals = acfe_form_map_vs_fields( $conditionals, $conditionals, $current_post_id, $form );
......
...@@ -11,13 +11,9 @@ ...@@ -11,13 +11,9 @@
<rule ref="WordPress"> <rule ref="WordPress">
<!-- Allow slash-delimited Hooks. --> <!-- Allow slash-delimited hooks. -->
<exclude name="WordPress.NamingConventions.ValidHookName.UseUnderscores" /> <exclude name="WordPress.NamingConventions.ValidHookName.UseUnderscores" />
<!-- Not a fan of arrow or equals alignment -->
<exclude name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned" />
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning" />
<!-- PSR4: Allow short file names. --> <!-- PSR4: Allow short file names. -->
<exclude name="WordPress.Files.FileName.InvalidClassFileName" /> <exclude name="WordPress.Files.FileName.InvalidClassFileName" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment