\EasyInputsInput

A class defining the HTML form element.

The Input class of Easy Inputs is instatiated with every new input created. What is returned is always a string. The create() function is used as the main entry point to the Input class, calling the function specified by the $args element 'type'. As a default, all Inputs are created as text inputs unless a specfic type is requested in that element.

Summary

Methods
Properties
Constants
create()
nonce()
verifyNonce()
generic()
text()
color()
date()
month()
week()
datetime()
datetimeLocal()
email()
number()
range()
output()
search()
tel()
time()
url()
radio()
select()
checkbox()
textarea()
button()
submitButton()
editor()
uploader()
get_image_id()
__construct()
$name
$type
$value
$attrs
$data
$options
$group
$validate
$wrapper
$multiple
$supported_attributes
No constants found
No protected methods found
No protected properties found
N/A
fieldName()
wrap()
doOptions()
toCamelCase()
No private properties found
N/A

Properties

$name

$name : 

The name of the instance of EasyInputs\Form\Input

Type

$type

$type : 

Text, textarea, radio, etc.

Type

$value

$value : 

A value to assign the input, or the selected element of a radio, checkbox or select.

Type

$attrs

$attrs : 

An optional array of HTML attributes to apply to the element.

Type

$data

$data : array

Data attribute/value pairs.

For any data-* attributes you may wish to add to the element, this array provides an attribute/value pair. Attribute names need not include "data-" prefix.

Type

array

$options

$options : 

For elements requiring options, they are held here.

Type

$group

$group : 

A comma-separated list of nested groups

Type

$validate

$validate : 

A validating function callback.

Type

$wrapper

$wrapper : 

A sprintf-compatible wrapper for the input.

Type

$multiple

$multiple : 

Setting this value to "true" will append the input's name with [], thereby making it capable of holding multiple values.

Type

$supported_attributes

$supported_attributes : 

List of supported attributes with regexes to validate against.

Type

Methods

create()

create() 

This function creates the HTML for the required input element.

nonce()

nonce() : string

Return a WP Settings API nonce field.

Port of the wp_nonce_field function. Don't over-think it. Just let WordPress handle creating the nonce. This function returns, rather than outputs, the nonce, in case we need to do something further before output.

Returns

string —

The output of the wp_nonce_field function.

verifyNonce()

verifyNonce() : boolean

Verify a nonce created by EasyInputs

Port of the wp_verify_nonce function.

Returns

boolean —

false, 1 or 2

generic()

generic() 

An HTML text input

text()

text() 

A text input

color()

color() 

A color picker input

date()

date() 

A date picker input

month()

month() 

A month picker input

week()

week() 

A week picker input

datetime()

datetime() 

A datetime picker input

datetimeLocal()

datetimeLocal() 

A datetime-local picker input

email()

email() 

A email input

number()

number() 

A number input

range()

range() 

A range slider input

output()

output() 

An output for other values

search()

search() 

A search input

tel()

tel() 

A telephone input

time()

time() 

A time input

url()

url() 

A url input

radio()

radio() 

An HTML radio button group

select()

select() 

Output an HTML select box with inputs

checkbox()

checkbox() 

Output a group of related HTML checkboxes

textarea()

textarea() 

Return an HTML textarea element.

button()

button() 

Return an HTML button

submitButton()

submitButton() 

Mimics the native WP submit_button function

editor()

editor() 

Wrapper function to return a wp_editor instance

uploader()

uploader() 

Creates a media uploader-compatible input. Note that the output HTML will still require the JS components of the Media Uploader to function.

get_image_id()

get_image_id(  $image_url) : mixed

Return the ID of the full-size image URL given.

Parameters

$image_url

Returns

mixed

__construct()

__construct(string  $name = null, array  $args = array(), \EasyInputs\EasyInputs\Form  $form = null) : mixed

Construct our Object

The $args array includes all the required values to construct an HTML element.

Parameters

string $name

The name of the field.

array $args

Either a string for the name of the field, or else an array of input arguments containing the above static values.

\EasyInputs\EasyInputs\Form $form

An instance of the Easy Inputs form class.

Returns

mixed —

HTML containing a legend or null.

fieldName()

fieldName() : string

Return a valid field name attribute.

Returns

string —

The combined

wrap()

wrap(string  $input, boolean  $label = true) : string

Wrap input in the requested HTML.

This function performs two essential tasks. The first is to include the requested

doOptions()

doOptions(array  $options) : mixed|array

Order our options into a consistent format

Parameters

array $options

The passed options.

Returns

mixed|array —

An EasyInputs array of options.

toCamelCase()

toCamelCase(string  $string) : string

Convert string to camelCase.

Parameters

string $string

The string to convert into camelCase

Returns

string —

aCamelCasedString, PSR2-style.