Email::template_form( string $active )

Description #

Generate email template form.

Parameters #

  • $active
    string (Required) Currently active template.

Changelog #

VersionDescription
4.1.0Introduced.

Source #

File: addons/email/email.php

	public function template_form( $active ) {
		$form     = anspress()->get_form( 'email_template' );
		$template = get_post( ap_opt( 'email_template_' . $active ) );

		if ( $template ) {
			$form->set_values(
				array(
					'subject' => $template->post_title,
					'body'    => $template->post_content,
				)
			);
		} else {
			$default_template = $this->get_default_template( $active );
			$form->set_values(
				array(
					'subject' => $default_template['subject'],
					'body'    => $default_template['body'],
				)
			);
		}

		$form->generate(
			array(
				'ajax_submit'   => true,
				'hidden_fields' => array(
					array(
						'name'  => 'action',
						'value' => 'ap_ajax',
					),
					array(
						'name'  => 'ap_ajax_action',
						'value' => 'form_email_template',
					),
					array(
						'name'  => 'template',
						'value' => $active,
					),
				),
			)
		);
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment