Completed
Push — master ( ed32be...1a3fa2 )
by Joro
14:27 queued 04:32
created

Oembed_Field::admin_enqueue_scripts()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Carbon_Fields\Field;
4
5
/**
6
 * Oembed field class.
7
 */
8
class Oembed_Field extends Field {
9
10
	/**
11
	 * Enqueue scripts and styles in admin
12
	 * Called once per field type
13
	 */
14
	public static function admin_enqueue_scripts() {
15
		wp_enqueue_script( 'wp-api' );
16
	}
17
18
	/**
19
	 * Returns an array that holds the field data, suitable for JSON representation.
20
	 *
21
	 * @param bool $load  Should the value be loaded from the database or use the value from the current instance.
22
	 * @return array
23
	 */
24
	public function to_json( $load ) {
25
		$field_data = parent::to_json( $load );
26
27
		$field_data = array_merge( $field_data, array(
28
			'value' => $this->get_value(),
29
		) );
30
31
		return $field_data;
32
	}
33
}
34