PluginProbe
Enter Addons – Ultimate Template Builder for Elementor / 2.3.2
Enter Addons – Ultimate Template Builder for Elementor v2.3.2
trunk 2.2.10 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4
enteraddons / core / settingsfields / Checkbox.php

Checkbox.php in Enter Addons – Ultimate Template Builder for Elementor 2.3.2, at core/settingsfields/Checkbox.php

77 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Enteraddons\Core;
3 /**
4 * Enteraddons Post Type Meta class
5 *
6 * @package EnterAddons Pro
7 * @author ThemeLooks
8 * @copyright 2022 ThemeLooks
9 * @license GPL-2.0-or-later
10 *
11 *
12 */
13
14
15 trait Checkbox {
16
17 protected static $args;
18
19 protected static $type = '';
20
21 public function checkbox_meta( $args ) {
22 self::$type = 'meta';
23 $this->checkbox( $args );
24 }
25
26 public function checkbox( $args ) {
27
28 $default = [
29 'title' => '',
30 'name' => '',
31 'description' => '',
32 'class' => '',
33 'condition' => ''
34 ];
35 self::$args = wp_parse_args( $args, $default );
36 $this->checkbox_markup();
37 }
38
39 protected function checkbox_markup() {
40
41 $args = self::$args;
42 $uniqName = $args['name'];
43
44 if( self::$type != 'meta' ) {
45 $wrapTypeClass = '';
46 $optionName = self::$optionName;
47 $getData = self::$getOptionData;
48 $fieldName = esc_attr( $optionName ).'['.$uniqName.']';
49 $value = !empty( $getData[$uniqName] ) ? $getData[$uniqName] : '';
50
51 } else {
52 $wrapTypeClass = 'ea-meta-field';
53 $fieldName = $uniqName;
54 $value = get_post_meta( get_the_ID(), $uniqName, true );
55 }
56
57 $conditionData = '';
58 if( !empty( $args['condition'] ) ) {
59 $conditionData = wp_json_encode( $args['condition'] );
60 }
61 ?>
62 <div class="eap-admin-field <?php echo esc_attr( $wrapTypeClass ); ?>" data-condition="<?php echo esc_html($conditionData); ?>">
63 <h4><?php echo esc_html( $args['title'] ); ?></h4>
64
65 <div class="fb-field-group">
66 <input type="checkbox" value="yes" name="<?php echo esc_attr( $fieldName ); ?>" <?php checked( esc_html( $value ), 'yes' ); ?> />
67 <?php
68 if( !empty( $args['description'] ) ) {
69 echo '<p>'.esc_html( $args['description'] ).'</p>';
70 }
71 ?>
72 </div>
73 </div>
74 <?php
75 }
76 }
77