PHP Class WPDKUIControl

[control label][control input][extra] In detail a WPDK ui control has the follow structure: [before] [before_label] [label control] [after_label] [prepend] [main control][extra] [append] [after] However every control class has its drawing method to manage different output. ## Overview This class allow to make simple display button and common UI.
Author: =undo= ([email protected])
Datei anzeigen Open project: wpxtreme/wpdk Class Usage Examples

Protected Properties

Property Type Description
$attrs array | string A string with list of attributes
$class string | array A string or an array with CSS classes
$data string | array A string or an array with list of data attributes
$id string A sanitize attribute id
$item array A key value pairs array with the WPDK ui control description
$name string The name attribute
$style string A string with inlibe CSS styles

Public Methods

Method Description
__construct ( array $item_control ) Create an instance of WPDKUIControl class
display ( ) Display the control
draw ( ) Drawing
html ( ) : string Return the HTML markup for control

Protected Methods

Method Description
attrs ( ) : string Return a string with complete list of generic attributes as title, id, etc.
classes ( ) : string Return a string with complete list of CSS class
contentWithKey ( string $key ) : string Return the content by specific key. If the content is an instance of class WPDKUIControl then get the HTML.
data ( ) : string Return a string with complete list of data attributes as data-name = "value". For example:
guide ( ) : string Return the HTML markup for the guide engine
inputType ( string | WPDKHTMLTagInputType $type = WPDKHTMLTagInputType::TEXT, string $class = '' ) This is a utility method to display a common input type
label ( ) : null | WPDKHTMLTagLabel Return an instance of WPDKHTMLTagLabel class or null if no label provided.

Private Methods

Method Description
sizeForType ( string $type ) : integer Return the specific attribute size for control type

Method Details

__construct() public method

Create an instance of WPDKUIControl class
public __construct ( array $item_control )
$item_control array Control array

attrs() protected method

..
protected attrs ( ) : string
return string

classes() protected method

Return a string with complete list of CSS class
protected classes ( ) : string
return string

contentWithKey() protected method

If the content is an array (Controls Layout array) porcess it as sub-control.
protected contentWithKey ( string $key ) : string
$key string String key in array
return string

data() protected method

The data asttributes are readable and writeable from jQuery with: $( 'div' ).data( 'my_attribute' );
protected data ( ) : string
return string

display() public method

Display the control
public display ( )

draw() public method

Drawing
public draw ( )

guide() protected method

Return the HTML markup for the guide engine
Since: 1.0.0.b4
protected guide ( ) : string
return string

html() public method

Return the HTML markup for control
public html ( ) : string
return string

inputType() protected method

This is a utility method to display a common input type
protected inputType ( string | WPDKHTMLTagInputType $type = WPDKHTMLTagInputType::TEXT, string $class = '' )
$type string | WPDKHTMLTagInputType Optional. Type of input
$class string Optional. CSS additional class

label() protected method

Return an instance of WPDKHTMLTagLabel class or null if no label provided.
protected label ( ) : null | WPDKHTMLTagLabel
return null | WPDKHTMLTagLabel

Property Details

$attrs protected_oe property

A string with list of attributes
protected array|string $attrs
return array | string

$class protected_oe property

A string or an array with CSS classes
protected string|array $class
return string | array

$data protected_oe property

A string or an array with list of data attributes
protected string|array $data
return string | array

$id protected_oe property

A sanitize attribute id
protected string $id
return string

$item protected_oe property

A key value pairs array with the WPDK ui control description
protected array $item
return array

$name protected_oe property

The name attribute
protected string $name
return string

$style protected_oe property

A string with inlibe CSS styles
protected string $style
return string