1 | <?php |
||
14 | class File_Field extends Field { |
||
15 | |||
16 | public $button_label = ''; |
||
17 | |||
18 | public $window_button_label = ''; |
||
19 | |||
20 | public $window_label = ''; |
||
21 | |||
22 | // empty for all types. available types: audio, video, image and all WordPress-recognized mime types |
||
23 | public $field_type = ''; |
||
24 | |||
25 | // alt, author, caption, dateFormatted, description, editLink, filename, height, icon, id, link, menuOrder, mime, name, status, subtype, title, type, uploadedTo, url, width |
||
26 | public $value_type = 'id'; |
||
27 | |||
28 | /** |
||
29 | * Admin initialization actions |
||
30 | */ |
||
31 | public function admin_init() { |
||
36 | |||
37 | /** |
||
38 | * Change the type of the field |
||
39 | * |
||
40 | * @param string $type |
||
41 | */ |
||
42 | public function set_type( $type ) { |
||
46 | |||
47 | /** |
||
48 | * Change the value type of the field. |
||
49 | * |
||
50 | * @param string $value_type |
||
51 | */ |
||
52 | public function set_value_type( $value_type ) { |
||
56 | |||
57 | /** |
||
58 | * Returns an array that holds the field data, suitable for JSON representation. |
||
59 | * |
||
60 | * @param bool $load Should the value be loaded from the database or use the value from the current instance. |
||
61 | * @return array |
||
62 | */ |
||
63 | public function to_json( $load ) { |
||
83 | } |
||
84 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.