1 | <?php |
||
14 | class MetaBox extends Component |
||
15 | { |
||
16 | use Condition; |
||
17 | use Instruction; |
||
18 | |||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | public $metaboxes = []; |
||
23 | |||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | public function init() |
||
37 | |||
38 | /** |
||
39 | * @return array |
||
40 | * @filter rwmb_meta_boxes |
||
41 | */ |
||
42 | public function register() |
||
52 | |||
53 | /** |
||
54 | * @return string |
||
55 | * @filter rwmb_outer_html |
||
56 | */ |
||
57 | public function renderField( $html, $field ) |
||
58 | { |
||
59 | return $this->validate( $field['condition'] ) |
||
60 | ? $html |
||
61 | : ''; |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * @return bool |
||
66 | * @filter rwmb_show |
||
67 | */ |
||
68 | public function show( $bool, array $metabox ) |
||
77 | |||
78 | /** |
||
79 | * @return int |
||
80 | */ |
||
81 | protected function getPostId() |
||
88 | |||
89 | /** |
||
90 | * @return array |
||
91 | */ |
||
92 | protected function getPostTypes() |
||
101 | |||
102 | /** |
||
103 | * @return string|array |
||
104 | */ |
||
105 | protected function getValue( $key, $group ) |
||
111 | |||
112 | /** |
||
113 | * @return bool |
||
114 | */ |
||
115 | protected function hasPostType( array $metabox ) |
||
122 | |||
123 | /** |
||
124 | * @return void |
||
125 | */ |
||
126 | protected function normalize( array $metaboxes, array $defaults = [] ) |
||
140 | |||
141 | /** |
||
142 | * @param string $depends |
||
143 | * @param string $parentId |
||
144 | * @return string |
||
145 | */ |
||
146 | protected function normalizeDepends( $depends, array $data, $parentId ) |
||
152 | |||
153 | /** |
||
154 | * @return array |
||
155 | */ |
||
156 | protected function normalizeFields( array $fields, array $data, $parentId ) |
||
171 | |||
172 | /** |
||
173 | * @param string $id |
||
174 | * @param string $parentId |
||
175 | * @return string |
||
176 | */ |
||
177 | protected function normalizeId( $id, array $data, $parentId ) |
||
181 | |||
182 | /** |
||
183 | * @param mixed $types |
||
184 | * @return array |
||
185 | */ |
||
186 | protected function normalizePostTypes( $types ) |
||
190 | |||
191 | /** |
||
192 | * @return array |
||
193 | */ |
||
194 | protected function setDependencies( array $metabox ) |
||
208 | } |
||
209 |