Noptin_Form::__construct( mixed $form = false )

Class constructor. Loads form data.


Parameters Parameters

$form

(mixed) (Optional) Form ID, array, or Noptin_Form instance.

Default value: false


Top ↑

Source Source

File: includes/class-noptin-form.php

	public function __construct( $form = false ) {

		// If this is an instance of the class...
		if ( $form instanceof Noptin_Form ) {
			$this->init( $form->get_all_data() );
			return;
		}

		// ... or an array of form properties.
		if ( is_array( $form ) ) {
			$this->init( $form );
			return;
		}

		// Try fetching the form by its post id.
		if ( ! empty( $form ) && is_numeric( $form ) ) {
			$form = absint( $form );

			$data = $this->get_data_by( 'id', $form );
			if ( $data ) {
				$this->init( $data );
				return;
			}
		}

		// If we are here then the form does not.
		$this->init( $this->get_defaults() );
	}


Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation