PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.41
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.41
5.5.84 5.5.83 5.5.82 5.5.81 5.5.80 5.5.79 5.5.77 5.5.76 5.5.75 5.5.73 5.5.72 5.5.22 5.5.23 5.5.29 5.5.3 5.5.31 5.5.32 5.5.34 5.5.35 5.5.36 5.5.37 5.5.4 5.5.40 5.5.41 5.5.42 All 160 releases
wp-data-access / WPDataAccess / Simple_Form / WPDA_Simple_Form_Item_Video.php

WPDA_Simple_Form_Item_Video.php in WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards 5.5.41, at WPDataAccess/Simple_Form/WPDA_Simple_Form_Item_Video.php

62 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Suppress "error - 0 - No summary was found for this file" on phpdoc generation
5 *
6 * @package WPDataAccess\Simple_Form
7 */
8
9 namespace WPDataAccess\Simple_Form {
10
11 class WPDA_Simple_Form_Item_Video extends WPDA_Simple_Form_Item_Media {
12
13 /**
14 * WPDA_Simple_Form_Item_Video constructor.
15 *
16 * @param array $args
17 */
18 public function __construct( $args = array() ) {
19 parent::__construct( $args );
20
21 $this->media_frame_title = __( 'Upload or select video(s) from your WordPress media library', 'wp-data-access' );
22 $this->media_frame_remove = __( 'Remove video(s)', 'wp-data-access' );
23 $this->media_types = 'video';
24 }
25
26 protected function show_item_media() {
27 if ( 'number' === $this->data_type ) {
28 // Column supports only one media file
29 $url = wp_get_attachment_url( $this->item_value );
30 if ( false !== $url ) {
31 $url = wp_get_attachment_url( $this->item_value );
32 $this->create_item_video( $url );
33 }
34 } else {
35 // Column supports multiple media files
36 if ( null !== $this->item_value && '' !== $this->item_value ) {
37 $media_ids = explode( ',', $this->item_value );//phpcs:ignore - 8.1 proof
38 foreach ( $media_ids as $media_id ) {
39 $url = wp_get_attachment_url( $media_id );
40 if ( false !== $url ) {
41 $this->create_item_video( $url );
42 }
43 }
44 }
45 }
46 }
47
48 private function create_item_video( $url ) {
49 ?>
50 <span class="wpda_media_container wpda_video">
51 <video controls>
52 <source src="<?php echo esc_url( $url ); ?>">
53 </video>
54 </span>
55 <?php
56
57 }
58
59 }
60
61 }
62