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 / Number.php

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

75 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 trait Number {
15
16 protected static $args;
17
18 public function number( $args ) {
19
20 $default = [
21 'title' => '',
22 'name' => '',
23 'description' => '',
24 'class' => '',
25 'default' => '',
26 'max' => '',
27 'min' => '',
28 'placeholder' => '',
29 'condition' => ''
30 ];
31
32 self::$args = wp_parse_args( $args, $default );
33
34 self::number_markup();
35
36 }
37
38 protected static function number_markup() {
39
40 $args = self::$args;
41 $uniqName = $args['name'];
42
43 if( self::$type != 'meta' ) {
44 $wrapTypeClass = '';
45 $optionName = self::$optionName;
46 $getData = self::$getOptionData;
47 $fieldName = esc_attr( $optionName ).'['.$uniqName.']';
48 $value = !empty( $getData[$uniqName] ) ? $getData[$uniqName] : '';
49
50 } else {
51 $wrapTypeClass = 'ea-meta-field ';
52 $fieldName = $uniqName;
53 $value = get_post_meta( get_the_ID(), $uniqName, true );
54 }
55
56 $conditionData = '';
57 if( !empty( $args['condition'] ) ) {
58 $conditionData = wp_json_encode( $args['condition'] );
59 }
60 ?>
61 <div class="eap-admin-field <?php echo esc_attr( $wrapTypeClass ); ?>" data-condition="<?php echo esc_html( $conditionData ); ?>">
62 <h4><?php echo esc_html( $args['title'] ); ?></h4>
63 <div class="fb-field-group">
64 <input type="number" min="<?php echo esc_attr( $args['min'] ); ?>" max="<?php echo esc_attr( $args['max'] ); ?>" name="<?php echo esc_attr( $fieldName ); ?>" placeholder="<?php echo esc_attr( $args['placeholder'] ); ?>" value="<?php echo esc_attr( $value ); ?>" />
65 <?php
66 if( !empty( $args['description'] ) ) {
67 echo '<p>'.esc_html( $args['description'] ).'</p>';
68 }
69 ?>
70 </div>
71 </div>
72 <?php
73 }
74 }
75