PluginProbe ʕ •ᴥ•ʔ
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF / trunk
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF vtrunk
2.0.5 trunk 1.3.7 1.4.0 1.4.1 1.4.2 1.4.6 1.5.0 1.5.3 1.5.6 1.5.8 1.6.5 1.6.6 1.6.9 1.7.0 1.7.4 1.8.1 1.8.2 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4
robin-image-optimizer / libs / factory / forms / controls / textbox.php
robin-image-optimizer / libs / factory / forms / controls Last commit date
customs 5 months ago holders 5 months ago checkbox.php 5 months ago color-and-opacity.php 5 months ago color.php 5 months ago datepicker-range.php 5 months ago dropdown-and-colors.php 5 months ago dropdown.php 5 months ago font.php 5 months ago google-font.php 5 months ago gradient.php 5 months ago hidden.php 5 months ago index.php 5 months ago integer.php 5 months ago list.php 5 months ago multiple-textbox.php 5 months ago paddings-editor.php 5 months ago pattern.php 5 months ago radio-colors.php 5 months ago radio.php 5 months ago textarea.php 5 months ago textbox.php 5 months ago url.php 5 months ago wp-editor.php 5 months ago
textbox.php
85 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 * @package factory-forms
22 * @since 1.0.0
23 */
24
25 // Exit if accessed directly
26 if ( ! defined( 'ABSPATH' ) ) {
27 exit;
28 }
29
30 if ( ! class_exists( 'Wbcr_FactoryForms600_TextboxControl' ) ) {
31
32 class Wbcr_FactoryForms600_TextboxControl extends Wbcr_FactoryForms600_Control {
33
34 public $type = 'textbox';
35
36 /**
37 * Preparing html attributes before rendering html of the control.
38 *
39 * @since 1.0.0
40 * @return void
41 */
42 protected function beforeHtml() {
43 $value = esc_attr( $this->getValue() );
44 $name_on_form = $this->getNameOnForm();
45
46 if ( $this->getOption( 'maxLength', false ) ) {
47 $this->addHtmlAttr( 'maxlength', intval( $this->getOption( 'maxLength' ) ) );
48 }
49
50 if ( $this->getOption( 'placeholder', false ) ) {
51 $this->addHtmlAttr( 'placeholder', $this->getOption( 'placeholder' ) );
52 }
53
54 $this->addCssClass( 'form-control' );
55 $this->addHtmlAttr( 'type', 'text' );
56 $this->addHtmlAttr( 'id', $name_on_form );
57 $this->addHtmlAttr( 'name', $name_on_form );
58 $this->addHtmlAttr( 'value', $value );
59 }
60
61 /**
62 * Shows the html markup of the control.
63 *
64 * @since 1.0.0
65 * @return void
66 */
67 public function html() {
68 $units = $this->getOption( 'units', false );
69 ?>
70 <?php
71 if ( $units ) {
72 ?>
73 <div class="input-group"><?php } ?>
74 <input <?php $this->attrs(); ?>/>
75 <?php if ( $units ) { ?>
76 <span class="input-group-addon"><?php echo esc_html( $units ); ?></span>
77 <?php } ?>
78 <?php
79 if ( $units ) {
80 ?>
81 </div><?php } ?>
82 <?php
83 }
84 }
85 }