Form::__set( string $property, mixed $value )

Magic setter.

Description

Sets a property value.

See also

Parameters

$property

(string) (Required) Property to set.

$value

(mixed) (Required) Property value.

Source

File: src/db-objects/forms/form.php

	public function __set( $property, $value ) {
		$found = false;
		$changed = false;

		switch ( $property ) {
			case 'id':
				return;
			case 'slug':
				$found = true;
				if ( $this->original->post_name !== $value ) {
					$this->original->post_name = $value;
					$changed = true;
				}
				break;
			case 'author':
				$found = true;
				if ( (int) $this->original->post_author !== (int) $value ) {
					$this->original->post_author = (int) $value;
					$changed = true;
				}
				break;
			case 'timestamp':
				$found = true;
				if ( (int) strtotime( $this->original->post_date_gmt ) !== (int) $value ) {
					$this->original->post_date = '0000-00-00 00:00:00';
					$this->original->post_date_gmt = date( 'Y-m-d H:i:s', $value );
					$changed = true;
				}
				break;
			case 'timestamp_modified':
				$found = true;
				if ( (int) strtotime( $this->original->post_modified_gmt ) !== (int) $value ) {
					$this->original->post_modified = '0000-00-00 00:00:00';
					$this->original->post_modified_gmt = date( 'Y-m-d H:i:s', $value );
					$changed = true;
				}
				break;
		}

		if ( $found ) {
			if ( $changed && ! in_array( $property, $this->pending_properties, true ) ) {
				$this->pending_properties[] = $property;
			}

			return;
		}

		parent::__set( $property, $value );
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.