Automattic\WooCommerce\Internal\StockNotifications\Emails

CustomerStockNotificationEmail::init_form_fieldspublicWC 1.0

Initialize Settings Form Fields.

Method of the class: CustomerStockNotificationEmail{}

No Hooks.

Returns

null. Nothing (null).

Usage

$CustomerStockNotificationEmail = new CustomerStockNotificationEmail();
$CustomerStockNotificationEmail->init_form_fields();

CustomerStockNotificationEmail::init_form_fields() code WC 10.3.6

public function init_form_fields() {

	parent::init_form_fields();

	if ( ! is_array( $this->form_fields ) ) {
		return;
	}

	/* translators: %s: list of placeholders */
	$placeholder_text = sprintf( __( 'Available placeholders: %s', 'woocommerce' ), '<code>' . esc_html( implode( '</code>, <code>', array_keys( $this->placeholders ) ) ) . '</code>' );

	$intro_content_field = array(
		'title'       => __( 'Email content', 'woocommerce' ),
		'description' => __( 'Text to appear below the main e-mail header.', 'woocommerce' ) . ' ' . $placeholder_text,
		'css'         => 'width: 400px; height: 75px;',
		'placeholder' => $this->get_default_intro_content(),
		'type'        => 'textarea',
		'desc_tip'    => true,
	);

	// Find `heading` key.
	$inject_index = array_search( 'heading', array_keys( $this->form_fields ), true );
	if ( $inject_index ) {
		++$inject_index;
	} else {
		$inject_index = 0;
	}

	// Inject.
	$this->form_fields = array_slice( $this->form_fields, 0, $inject_index, true ) + array( 'intro_content' => $intro_content_field ) + array_slice( $this->form_fields, $inject_index, count( $this->form_fields ) - $inject_index, true );
}