PHP Class WPDKHTMLTagSelect

Remeber to add this tag in WPDKHTMLTagName
Author: =undo= ([email protected])
Inheritance: extends WPDKHTMLTag
Show file Open project: wpxtreme/wpdk Class Usage Examples

Public Properties

Property Type Description
$_first_item string Used to display a special first item (disable and display none and non selectable) to use instead label
$autofocus * Interface.
$disabled
$form
$multiple
$name
$size
$value

Public Methods

Method Description
__construct ( array | callback $options = [], string $name = '', string $id = '' ) Create an instance of WPDKHTMLTagSelect class
draw ( ) Override parent method for draw the options with selectd values.
options ( array $options ) : string Return the HTML markup for the option and optgroup tag.
selected ( string | array $haystack, mixed $current ) : string Return HTML selected attribute or empty string.

Private Methods

Method Description
_options ( array $options ) Recursive method to build the options and option group for select tag.

Method Details

__construct() public method

Create an instance of WPDKHTMLTagSelect class
public __construct ( array | callback $options = [], string $name = '', string $id = '' )
$options array | callback A key value pairs array with value/text or a callback function
$name string Attribute name
$id string Attribute id

draw() public method

Override parent method for draw the options with selectd values.
public draw ( )

options() public method

Return the HTML markup for the option and optgroup tag.
public options ( array $options ) : string
$options array A key value pairs array. If the value is an array then an optio group is created.
return string

selected() public static method

Commodity to extends selected() WordPress function with array check.
Since: 1.2.0
public static selected ( string | array $haystack, mixed $current ) : string
$haystack string | array Single value or array
$current mixed (true) The other value to compare if not just true
return string HTML attribute or empty string

Property Details

$_first_item public property

Used to display a special first item (disable and display none and non selectable) to use instead label
Since: 1.4.8
public string $_first_item
return string

$autofocus public property

* Interface.
public $autofocus

$disabled public property

public $disabled

$form public property

public $form

$multiple public property

public $multiple

$name public property

public $name

$size public property

public $size

$value public property

public $value