PHP Класс PodsForm, pods

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$field string
$field_group string
$field_type string
$field_types array
$form_counter integer
$loaded array

Защищенные свойства (Protected)

Свойство Тип Описание
$instance PodsForm

Открытые методы

Метод Описание
admin_init ( ) Run admin_init methods for each field type
attributes ( $attributes, $name = null, $type = null, $options = null ) Output a field's attributes
block_field_types ( ) : array Get list of available text field types
clean ( $input, $noarray = false, $db_field = false ) Clean a value for use in class / id
comment ( string $name, string $message = null, array $options = null ) : string Output a Field Comment Paragraph
data ( $data, $name = null, $type = null, $options = null ) Output a field's data (for use with jQuery)
date_field_types ( ) : array Get list of available date field types
default_value ( $value, $type = 'text', $name = null, $options = null, $pod = null, $id = null ) Parse the default the value
delete ( string $type, integer $id = null, string $name = null, array $options = null, array $pod = null ) Delete the value from the DB
dependencies ( array $options, string $prefix = '' ) : string Setup dependency / exclusion classes
display ( $type, mixed $value = null, string $name = null, array $options = null, array $pod = null, integer $id = null, array $traverse = null ) Change the way the value of the field is displayed with Pods::get
field ( string $name, mixed $value, string $type = 'text', array $options = null, array $pod = null, integer $id = null ) : string Output a field
field_loader ( string $field_type, string $file = '' ) : string Autoload a Field Type's class
field_method ( ) : mixed Run a method from a Field Type's class
field_setup ( null $field = null, null $core_defaults = null, null $type = null ) : array | null Get options for a field and setup defaults
field_types ( ) : array Get a list of all available field types and include
fields_setup ( null $fields = null, null $core_defaults = null, boolean $single = false ) : array | null Get options for a field and setup defaults
file_field_types ( ) : array Get list of available file field types
init ( ) : PodsForm Singleton handling for a basic pods_form() request
label ( string $name, string $label, string $help = '', array $options = null ) : string Output a field's label
merge_attributes ( $attributes, $name = null, $type = null, $options = null, $classes = '' ) Merge attributes and handle classes
number_field_types ( ) : array Get list of available number field types
options ( $type, $options ) : array Setup options for a field and store them for later use
options_setup ( $type = null, $options = null ) : array | null Get options for a field type and setup defaults
permission ( $type, null $name = null, null $options = null, null $fields = null, null $pod = null, null $id = null, null $params = null ) Check if a user has permission to be editing a field
pre_save ( string $type, mixed $value, integer $id = null, string $name = null, array $options = null, array $fields = null, array $pod = null, object $params = null ) Change the value or perform actions after validation but before saving to the DB
prepare ( $type, $options ) : mixed | void Setup value preparation for sprintf
regex ( $type, $options ) : mixed | void Setup regex for JS / PHP
register_field_type ( string $type, string $file = null ) : array Add a new Pod field type
repeatable_field_types ( ) : array Get list of available repeatable field types
row ( string $name, mixed $value, string $type = 'text', array $options = null, array $pod = null, integer $id = null ) : string Output a row (label, field, and comment)
save ( string $type, mixed $value, integer $id = null, string $name = null, array $options = null, array $fields = null, array $pod = null, object $params = null ) Save the value to the DB
simple_tableless_objects ( ) : array Get list of available text field types
submit_button ( string $text = null, string $type = 'primary large', string $name = 'submit', boolean $wrap = true, array | string $other_attributes = null ) Returns a submit button, with provided text and appropriate class, copied from WP Core for use on the frontend
tableless_field_types ( ) : array Get list of available tableless field types
text_field_types ( ) : array Get list of available text field types
ui_options ( $type ) : array | null Get Admin options for a field type and setup defaults
validate ( string $type, mixed $value, string $name = null, array $options = null, array $fields = null, array $pod = null, integer $id = null, array | object $params = null ) Validate a value before it's saved
value ( $type, mixed $value = null, string $name = null, array $options = null, array $pod = null, integer $id = null, array $traverse = null ) Change the value of the field

Защищенные методы

Метод Описание
field_db ( $name, $value = null, $options = null ) Output field type 'db'
field_hidden ( $name, $value = null, $options = null ) Output a hidden field

Приватные методы

Метод Описание
__clone ( ) Prevent clones
__construct ( ) : PodsForm Master handler for all field / form methods

Описание методов

admin_init() публичный Метод

Run admin_init methods for each field type
С версии: 2.3
public admin_init ( )

attributes() публичный статический Метод

Output a field's attributes
С версии: 2.0
public static attributes ( $attributes, $name = null, $type = null, $options = null )

block_field_types() публичный статический Метод

Get list of available text field types
С версии: 2.3
public static block_field_types ( ) : array
Результат array Text field types

clean() публичный статический Метод

Clean a value for use in class / id
С версии: 2.0
public static clean ( $input, $noarray = false, $db_field = false )

comment() публичный статический Метод

Output a Field Comment Paragraph
С версии: 2.0
public static comment ( string $name, string $message = null, array $options = null ) : string
$name string Field name
$message string Field comments
$options array Field options
Результат string Comment HTML

data() публичный статический Метод

Output a field's data (for use with jQuery)
С версии: 2.0
public static data ( $data, $name = null, $type = null, $options = null )

date_field_types() публичный статический Метод

Get list of available date field types
С версии: 2.3
public static date_field_types ( ) : array
Результат array Date field types

default_value() публичный статический Метод

Parse the default the value
С версии: 2.0
public static default_value ( $value, $type = 'text', $name = null, $options = null, $pod = null, $id = null )

delete() публичный статический Метод

Delete the value from the DB
С версии: 2.3
public static delete ( string $type, integer $id = null, string $name = null, array $options = null, array $pod = null )
$type string
$id integer
$name string
$options array
$pod array

dependencies() публичный статический Метод

Setup dependency / exclusion classes
С версии: 2.0
public static dependencies ( array $options, string $prefix = '' ) : string
$options array array( 'depends-on' => ..., 'excludes-on' => ...)
$prefix string
Результат string

display() публичный статический Метод

Change the way the value of the field is displayed with Pods::get
С версии: 2.0
public static display ( $type, mixed $value = null, string $name = null, array $options = null, array $pod = null, integer $id = null, array $traverse = null )
$value mixed
$name string
$options array
$pod array
$id integer
$traverse array

field() публичный статический Метод

Output a field
С версии: 2.0
public static field ( string $name, mixed $value, string $type = 'text', array $options = null, array $pod = null, integer $id = null ) : string
$name string Field name
$value mixed Field value
$type string Field type
$options array Field options
$pod array Pod data
$id integer Item ID
Результат string Field HTML

field_db() защищенный статический Метод

Used for field names and other places where only [a-z0-9_] is accepted
С версии: 2.0
protected static field_db ( $name, $value = null, $options = null )

field_hidden() защищенный статический Метод

Output a hidden field
protected static field_hidden ( $name, $value = null, $options = null )

field_loader() публичный статический Метод

Autoload a Field Type's class
С версии: 2.0
public static field_loader ( string $field_type, string $file = '' ) : string
$field_type string Field Type indentifier
$file string The Field Type class file location
Результат string

field_method() публичный статический Метод

Run a method from a Field Type's class
С версии: 2.0
public static field_method ( ) : mixed
Результат mixed

field_setup() публичный статический Метод

Get options for a field and setup defaults
С версии: 2.0
public static field_setup ( null $field = null, null $core_defaults = null, null $type = null ) : array | null
$field null
$core_defaults null
$type null
Результат array | null

field_types() публичный статический Метод

Get a list of all available field types and include
С версии: 2.3
public static field_types ( ) : array
Результат array Registered Field Types data

fields_setup() публичный статический Метод

Get options for a field and setup defaults
С версии: 2.0
public static fields_setup ( null $fields = null, null $core_defaults = null, boolean $single = false ) : array | null
$fields null
$core_defaults null
$single boolean
Результат array | null

file_field_types() публичный статический Метод

Get list of available file field types
С версии: 2.3
public static file_field_types ( ) : array
Результат array File field types

init() публичный статический Метод

Singleton handling for a basic pods_form() request
С версии: 2.3.5
public static init ( ) : PodsForm
Результат PodsForm

label() публичный статический Метод

Output a field's label
С версии: 2.0
public static label ( string $name, string $label, string $help = '', array $options = null ) : string
$name string Field name
$label string Label text
$help string Help text
$options array Field options
Результат string Label HTML

merge_attributes() публичный статический Метод

Merge attributes and handle classes
С версии: 2.0
public static merge_attributes ( $attributes, $name = null, $type = null, $options = null, $classes = '' )

number_field_types() публичный статический Метод

Get list of available number field types
С версии: 2.3
public static number_field_types ( ) : array
Результат array Number field types

options() публичный статический Метод

Setup options for a field and store them for later use
С версии: 2.0
public static options ( $type, $options ) : array
$type
$options
Результат array

options_setup() публичный статический Метод

Get options for a field type and setup defaults
С версии: 2.0
public static options_setup ( $type = null, $options = null ) : array | null
$type
Результат array | null

permission() публичный статический Метод

Check if a user has permission to be editing a field
С версии: 2.0
public static permission ( $type, null $name = null, null $options = null, null $fields = null, null $pod = null, null $id = null, null $params = null )
$type
$name null
$options null
$fields null
$pod null
$id null
$params null

pre_save() публичный статический Метод

Change the value or perform actions after validation but before saving to the DB
С версии: 2.0
public static pre_save ( string $type, mixed $value, integer $id = null, string $name = null, array $options = null, array $fields = null, array $pod = null, object $params = null )
$type string
$value mixed
$id integer
$name string
$options array
$fields array
$pod array
$params object

prepare() публичный статический Метод

Setup value preparation for sprintf
С версии: 2.0
public static prepare ( $type, $options ) : mixed | void
$type
$options
Результат mixed | void

regex() публичный статический Метод

Setup regex for JS / PHP
С версии: 2.0
public static regex ( $type, $options ) : mixed | void
$type
$options
Результат mixed | void

register_field_type() публичный статический Метод

Add a new Pod field type
С версии: 2.3
public static register_field_type ( string $type, string $file = null ) : array
$type string The new field type identifier
$file string The new field type class file location
Результат array Field Type data

repeatable_field_types() публичный статический Метод

Get list of available repeatable field types
С версии: 2.3
public static repeatable_field_types ( ) : array
Результат array Repeatable field types

row() публичный статический Метод

Output a row (label, field, and comment)
С версии: 2.0
public static row ( string $name, mixed $value, string $type = 'text', array $options = null, array $pod = null, integer $id = null ) : string
$name string Field name
$value mixed Field value
$type string Field type
$options array Field options
$pod array Pod data
$id integer Item ID
Результат string Row HTML

save() публичный статический Метод

Save the value to the DB
С версии: 2.3
public static save ( string $type, mixed $value, integer $id = null, string $name = null, array $options = null, array $fields = null, array $pod = null, object $params = null )
$type string
$value mixed
$id integer
$name string
$options array
$fields array
$pod array
$params object

simple_tableless_objects() публичный статический Метод

Get list of available text field types
С версии: 2.3
public static simple_tableless_objects ( ) : array
Результат array Text field types

submit_button() публичный статический Метод

Returns a submit button, with provided text and appropriate class, copied from WP Core for use on the frontend
См. также: get_submit_button
С версии: 3.0
public static submit_button ( string $text = null, string $type = 'primary large', string $name = 'submit', boolean $wrap = true, array | string $other_attributes = null )
$text string The text of the button (defaults to 'Save Changes')
$type string The type of button. One of: primary, secondary, delete
$name string The HTML name of the submit button. Defaults to "submit". If no id attribute is given in $other_attributes below, $name will be used as the button's id.
$wrap boolean True if the output button should be wrapped in a paragraph tag, false otherwise. Defaults to true
$other_attributes array | string Other attributes that should be output with the button, mapping attributes to their values, such as array( 'tabindex' => '1' ). These attributes will be output as attribute="value", such as tabindex="1". Defaults to no other attributes. Other attributes can also be provided as a string such as 'tabindex="1"', though the array format is typically cleaner.

tableless_field_types() публичный статический Метод

Get list of available tableless field types
С версии: 2.3
public static tableless_field_types ( ) : array
Результат array Tableless field types

text_field_types() публичный статический Метод

Get list of available text field types
С версии: 2.3
public static text_field_types ( ) : array
Результат array Text field types

ui_options() публичный статический Метод

Get Admin options for a field type and setup defaults
С версии: 2.0
public static ui_options ( $type ) : array | null
$type
Результат array | null

validate() публичный статический Метод

Validate a value before it's saved
С версии: 2.0
public static validate ( string $type, mixed $value, string $name = null, array $options = null, array $fields = null, array $pod = null, integer $id = null, array | object $params = null )
$type string
$value mixed
$name string
$options array
$fields array
$pod array
$id integer
$params array | object

value() публичный статический Метод

Change the value of the field
С версии: 2.3
public static value ( $type, mixed $value = null, string $name = null, array $options = null, array $pod = null, integer $id = null, array $traverse = null )
$value mixed
$name string
$options array
$pod array
$id integer
$traverse array

Описание свойств

$field статическое публичное свойство

static public string $field
Результат string

$field_group статическое публичное свойство

static public string $field_group
Результат string

$field_type статическое публичное свойство

static public string $field_type
Результат string

$field_types статическое публичное свойство

static public array $field_types
Результат array

$form_counter статическое публичное свойство

static public int $form_counter
Результат integer

$instance защищенное статическое свойство

protected static PodsForm $instance
Результат PodsForm

$loaded статическое публичное свойство

static public array $loaded
Результат array