PluginProbe
Menu Icons by Themeisle – Add Icons to Navigation Menus / 0.13.24
Menu Icons by Themeisle – Add Icons to Navigation Menus v0.13.24
0.13.24 trunk 0.1.0 0.1.1 0.1.2 0.1.3 0.1.4 0.1.5 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.11.2 0.11.3 0.11.4 0.11.5 0.12.0 0.12.1 0.12.10 0.12.11 0.12.12 0.12.2 0.12.3 0.12.4 All 70 releases
menu-icons / vendor / codeinwp / icon-picker / includes / fields / cmb.php
cmb.php
49 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * 'icon' field type for Custom Meta Boxes
5 *
6 * @link https://github.com/humanmade/Custom-Meta-Boxes/wiki/Adding-your-own-field-types CMB Wiki
7 * @version 0.1.1
8 * @since Icon_Picker 0.2.0
9 */
10 class Icon_Picker_Field_Cmb extends CMB_Field {
11 /**
12 * Constructor
13 *
14 * @since 0.1.0
15 * @see {CMB_Field::__construct()}
16 */
17 public function __construct( $name, $title, array $values, $args = array() ) {
18 parent::__construct( $name, $title, $values, $args );
19 Icon_Picker::instance()->load();
20 }
21
22 /**
23 * Parse save values
24 *
25 * When used as a sub-field of a `group` field, wrap the values with array.
26 *
27 * @since 0.1.1
28 */
29 public function parse_save_values() {
30 if ( ! empty( $this->parent ) ) {
31 $this->values = array( $this->values );
32 }
33 }
34
35 /**
36 * Display the field
37 *
38 * @since 0.1.0
39 * @see {CMB_Field::html()}
40 */
41 public function html() {
42 icon_picker_field( array(
43 'id' => $this->id,
44 'name' => $this->get_the_name_attr(),
45 'value' => $this->get_value(),
46 ) );
47 }
48 }
49