Video_Post::set_embed_options( array $values = array(), bool $_use_defaults = false )

Update video playback options


Parameters

$values

(Optional)

Default value: array()

$_use_defaults

(Optional)

Default value: false


Return

(void)


Source

File: includes/libs/video-post.class.php

	public function set_embed_options( $values = [], $_use_defaults = false ){
		if( !$this->_post ){
			return;
		}

		$defaults = Helper::get_embed_options();

		foreach( $defaults as $key => $val ){
			if( is_numeric( $val ) ){
				if( isset( $values[ $key ] ) ){
					$defaults[ $key ] = (int)$values[ $key ];
				}else{
					// if flagged to use the default values, just skip the setting and allow the default
					if( $_use_defaults ){
						continue;
					}

					// some defaults are numeric but can only have value 1 or 0
					// if so, the option is a checkbox that is unchecked, set it to 0
					if( 0 == $defaults[$key] || 1 == $defaults[$key] ){
						$defaults[ $key ] = 0;
					}
				}
				continue;
			}
			if( is_bool( $val ) ){
				if( $_use_defaults ){
					continue;
				}

				$defaults[ $key ] = isset( $values[ $key ] );
				continue;
			}

			if( isset( $values[ $key ] ) ){
				$defaults[ $key ] = $values[ $key ];
			}
		}

		$this->update_meta(
			$this->cpt()->get_post_settings()->get_meta_embed_settings(),
			$defaults
		);
	}

Start your video site now!

Manage and coordinate your Vimeo channels, albums or videos with your WordPress website. Perfect fit for membership, portfolio, online courses or any type of video collection.

Get Vimeotheque PRO!