WC_Email_Customer_Review_Request::init_form_fieldspublicWC 1.0

Initialise settings form fields.

Adds a delay_days field on top of the standard WC_Email fields so merchants can change how long to wait before asking for a review.

Method of the class: WC_Email_Customer_Review_Request{}

No Hooks.

Returns

null. Nothing (null).

Usage

$WC_Email_Customer_Review_Request = new WC_Email_Customer_Review_Request();
$WC_Email_Customer_Review_Request->init_form_fields(): void;

WC_Email_Customer_Review_Request::init_form_fields() code WC 10.8.1

public function init_form_fields(): void {
	$placeholder_text = sprintf(
		/* translators: %s: list of placeholders */
		__( 'Available placeholders: %s', 'woocommerce' ),
		'<code>' . implode( '</code>, <code>', array_map( 'esc_html', array_keys( $this->placeholders ) ) ) . '</code>'
	);
	$this->form_fields = array(
		'enabled'            => array(
			'title'   => __( 'Enable/Disable', 'woocommerce' ),
			'type'    => 'checkbox',
			'label'   => __( 'Enable this email notification', 'woocommerce' ),
			'default' => 'no',
		),
		'delay_days'         => array(
			'title'             => __( 'Delay (days)', 'woocommerce' ),
			'type'              => 'number',
			'description'       => __( 'How many days after the order is marked complete before the review request email is sent.', 'woocommerce' ),
			'default'           => (string) self::DEFAULT_DELAY_DAYS,
			'desc_tip'          => true,
			'custom_attributes' => array(
				'min'  => (string) self::MIN_DELAY_DAYS,
				'max'  => (string) self::MAX_DELAY_DAYS,
				'step' => '1',
			),
		),
		'subject'            => array(
			'title'       => __( 'Subject', 'woocommerce' ),
			'type'        => 'text',
			'desc_tip'    => true,
			'description' => $placeholder_text,
			'placeholder' => $this->get_default_subject(),
			'default'     => '',
		),
		'heading'            => array(
			'title'       => __( 'Email heading', 'woocommerce' ),
			'type'        => 'text',
			'desc_tip'    => true,
			'description' => $placeholder_text,
			'placeholder' => $this->get_default_heading(),
			'default'     => '',
		),
		'additional_content' => array(
			'title'       => __( 'Additional content', 'woocommerce' ),
			'description' => __( 'Text to appear below the main email content.', 'woocommerce' ) . ' ' . $placeholder_text,
			'css'         => 'width:400px; height: 75px;',
			'placeholder' => __( 'N/A', 'woocommerce' ),
			'type'        => 'textarea',
			'default'     => $this->get_default_additional_content(),
			'desc_tip'    => true,
		),
		'email_type'         => array(
			'title'       => __( 'Email type', 'woocommerce' ),
			'type'        => 'select',
			'description' => __( 'Choose which format of email to send.', 'woocommerce' ),
			'default'     => 'html',
			'class'       => 'email_type wc-enhanced-select',
			'options'     => $this->get_email_type_options(),
			'desc_tip'    => true,
		),
	);

	if ( FeaturesUtil::feature_is_enabled( 'email_improvements' ) ) {
		$this->form_fields['cc']  = $this->get_cc_field();
		$this->form_fields['bcc'] = $this->get_bcc_field();
	}
	if ( $this->block_email_editor_enabled ) {
		$this->form_fields['preheader'] = $this->get_preheader_field();
	}
}