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
WPEditor.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ProfilePress\Core\Admin\SettingsPages\DragDropBuilder\Controls; |
| 4 | |
| 5 | |
| 6 | class WPEditor |
| 7 | { |
| 8 | public $args; |
| 9 | |
| 10 | public function __construct($args) |
| 11 | { |
| 12 | $this->args = wp_parse_args( |
| 13 | $args, |
| 14 | ['name' => '', 'value' => sprintf('{{data.%s}}', esc_attr($args['name']))] |
| 15 | ); |
| 16 | } |
| 17 | |
| 18 | public function render() |
| 19 | { |
| 20 | echo sprintf('<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 sprintf( |
| 27 | // 100%% double 1% cos we are escaping % |
| 28 | '<textarea style="height: 300px;padding: 10px;width: 100%%" placeholder="%3$s" id="%1$s" name="%1$s" class="pp-form-control pp-form-control-wpeditor">%2$s</textarea>', |
| 29 | esc_attr($this->args['name']), |
| 30 | $this->args['value'], |
| 31 | esc_attr(ppress_var($this->args, 'placeholder')) |
| 32 | ); |
| 33 | } |
| 34 | } |