IconPicker.php
1 year ago
Input.php
3 years ago
Select.php
4 years ago
Textarea.php
3 years ago
WPEditor.php
3 years ago
IconPicker.php
43 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ProfilePress\Core\Admin\SettingsPages\DragDropBuilder\Controls; |
| 4 | |
| 5 | |
| 6 | class IconPicker |
| 7 | { |
| 8 | public $args; |
| 9 | |
| 10 | public function __construct($args) |
| 11 | { |
| 12 | $this->args = wp_parse_args( |
| 13 | $args, |
| 14 | ['value' => sprintf('{{data.%s}}', esc_attr($args['name']))] |
| 15 | ); |
| 16 | } |
| 17 | |
| 18 | public function render() |
| 19 | { |
| 20 | printf('<label for="%s" class="pp-label">%s</label>', $this->args['name'], $this->args['label']); |
| 21 | |
| 22 | if (isset($this->args['description'])) { |
| 23 | printf('<div class="pp-form-control-description">%s</div>', wp_kses_post($this->args['description'])); |
| 24 | } |
| 25 | |
| 26 | echo '<div class="pp-form-control-icon-picker-wrap">'; |
| 27 | |
| 28 | printf( |
| 29 | '<input style="display: none" class="pp-form-control" type="hidden" id="%1$s" name="%1$s" value="%2$s">', |
| 30 | $this->args['name'], |
| 31 | ppress_var($this->args, 'value', '') |
| 32 | ); |
| 33 | |
| 34 | echo '<div class="pp-form-control pp-form-control-icon-picker">'; |
| 35 | printf( |
| 36 | '<# var material_icon = wp.template("pp-form-builder-material-icon")({icon:data.%1$s}); #> {{{ material_icon }}}', |
| 37 | $this->args['name'] ?? '' |
| 38 | ); |
| 39 | echo '</div>'; |
| 40 | |
| 41 | echo '</div>'; |
| 42 | } |
| 43 | } |