PluginProbe ʕ •ᴥ•ʔ
Disable Admin Notices – Hide Dashboard Notifications / trunk
Disable Admin Notices – Hide Dashboard Notifications vtrunk
1.4.5 trunk 1.0.0 1.0.2 1.0.3 1.0.5 1.0.6 1.1.1 1.1.3 1.1.4 1.2.0 1.2.2 1.2.3 1.2.4 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4
disable-admin-notices / libs / factory / forms / controls / textbox.php
disable-admin-notices / libs / factory / forms / controls Last commit date
customs 1 year ago holders 1 year ago checkbox.php 1 year ago color-and-opacity.php 1 year ago color.php 1 year ago datepicker-range.php 1 year ago dropdown-and-colors.php 1 year ago dropdown.php 1 year ago font.php 1 year ago google-font.php 1 year ago gradient.php 1 year ago hidden.php 1 year ago index.php 3 years ago integer.php 1 year ago list.php 1 year ago multiple-textbox.php 1 year ago paddings-editor.php 1 year ago pattern.php 1 year ago radio-colors.php 1 year ago radio.php 1 year ago textarea.php 1 year ago textbox.php 1 year ago url.php 1 year ago wp-editor.php 1 year ago
textbox.php
84 lines
1 <?php
2
3 /**
4 * Textbox Control
5 *
6 * Main options:
7 * name => a name of the control
8 * value => a value to show in the control
9 * default => a default value of the control if the "value" option is not specified
10 * maxLength => set the max length of text in the input control
11 * placeholder => a placeholder text for the control when the control value is empty
12 *
13 * Использование datepicker в текстовом поле (необ�
14 одимо подключить bootstrap.datepicker)
15 * 'htmlAttrs' => array(
16 * 'data-provide' => 'datepicker-inline',
17 * 'data-date-language' => 'ru',
18 * 'data-date-autoclose' => 'true'
19 * )
20 *
21 * @author Alex Kovalev <alex.kovalevv@gmail.com>
22 * @copyright (c) 2018, Webcraftic Ltd
23 *
24 * @package factory-forms
25 * @since 1.0.0
26 */
27
28 // Exit if accessed directly
29 if( !defined('ABSPATH') ) {
30 exit;
31 }
32
33 if( !class_exists('Wbcr_FactoryForms480_TextboxControl') ) {
34
35 class Wbcr_FactoryForms480_TextboxControl extends Wbcr_FactoryForms480_Control {
36
37 public $type = 'textbox';
38
39 /**
40 * Preparing html attributes before rendering html of the control.
41 *
42 * @since 1.0.0
43 * @return void
44 */
45 protected function beforeHtml()
46 {
47 $value = esc_attr($this->getValue());
48 $name_on_form = $this->getNameOnForm();
49
50 if( $this->getOption('maxLength', false) ) {
51 $this->addHtmlAttr('maxlength', intval($this->getOption('maxLength')));
52 }
53
54 if( $this->getOption('placeholder', false) ) {
55 $this->addHtmlAttr('placeholder', $this->getOption('placeholder'));
56 }
57
58 $this->addCssClass('form-control');
59 $this->addHtmlAttr('type', 'text');
60 $this->addHtmlAttr('id', $name_on_form);
61 $this->addHtmlAttr('name', $name_on_form);
62 $this->addHtmlAttr('value', $value);
63 }
64
65 /**
66 * Shows the html markup of the control.
67 *
68 * @since 1.0.0
69 * @return void
70 */
71 public function html()
72 {
73 $units = $this->getOption('units', false);
74 ?>
75 <?php if( $units ) { ?><div class="input-group"><?php } ?>
76 <input <?php $this->attrs() ?>/>
77 <?php if( $units ) { ?>
78 <span class="input-group-addon"><?php echo esc_html($units); ?></span>
79 <?php } ?>
80 <?php if( $units ) { ?></div><?php } ?>
81 <?php
82 }
83 }
84 }