File "CMB2_Type_Text.php"
Full Path: /home/veodprin/public_html/wp-content/plugins/cmb2/includes/types/CMB2_Type_Text.php
File size: 1.38 KB
MIME-type: text/x-php
Charset: utf-8
<?php
/**
* CMB text field type
*
* @since 2.2.2
*
* @category WordPress_Plugin
* @package CMB2
* @author CMB2 team
* @license GPL-2.0+
* @link https://cmb2.io
*/
class CMB2_Type_Text extends CMB2_Type_Counter_Base {
/**
* The type of field
*
* @var string
*/
public $type = 'input';
/**
* Constructor
*
* @since 2.2.2
*
* @param CMB2_Types $types
* @param array $args
*/
public function __construct( CMB2_Types $types, $args = array(), $type = '' ) {
parent::__construct( $types, $args );
$this->type = $type ? $type : $this->type;
}
/**
* Handles outputting an 'input' element
*
* @since 1.1.0
* @param array $args Override arguments
* @return string Form input element
*/
public function render( $args = array() ) {
$args = empty( $args ) ? $this->args : $args;
$a = $this->parse_args( $this->type, array(
'type' => 'text',
'class' => 'regular-text',
'name' => $this->_name(),
'id' => $this->_id(),
'value' => $this->field->escaped_value(),
'desc' => $this->_desc( true ),
'js_dependencies' => array(),
), $args );
// Add character counter?
$a = $this->maybe_update_attributes_for_char_counter( $a );
return $this->rendered(
sprintf( '<input%s/>%s', $this->concat_attrs( $a, array( 'desc' ) ), $a['desc'] )
);
}
}