true, 'oembed' => false, 'url' => '', 'loop' => '', 'autoplay' => '', 'muted' => 'muted', 'controls' => 'controls' ); $options = ( ! empty( $this->field['options'] ) ) ? $this->field['options'] : array(); $this->field['options'] = wp_parse_args( $options, $defaults ); } public function output() { echo $this->element_before(); echo '
element_class() . '>
'; /** * If user want only to display a video (without input field), will be never saved, * because no input. So if value is empty end input is disabled, display default. */ $video_url = ''; if ( empty( $this->element_value() ) && ( isset( $this->field['options']['input'] ) && false == $this->field['options']['input'] ) && isset( $this->field['default'] ) ) { $video_url = $this->field['default']; } else { $video_url = $this->element_value(); } if ( $this->field['options']['oembed'] ) { echo wp_oembed_get( $video_url ); } else { $video_atts = array( $this->field['options']['loop'], $this->field['options']['autoplay'], $this->field['options']['muted'], $this->field['options']['controls'] ); echo ''; } echo '
'; if ( $this->field['options']['input'] ) { echo '
'; echo 'element_attributes() . '/>'; if ( ! $this->field['options']['oembed'] ) { echo '' . esc_attr__( 'Add Video', 'exopite-sof' ) . ''; } echo '
'; } echo '
'; echo $this->element_after(); } } }