PHP Class PodsField_Pick, pods

Inheritance: extends PodsField
Show file Open project: pods-framework/pods Class Usage Examples

Public Properties

Property Type Description
$custom_related_objects array Custom Related Objects
$field_data array Data used during input method (mainly for autocomplete)
$group string Field Type Group
$label string Field Type Label
$related_data array Data used during validate / save to avoid extra queries
$related_objects array Available Related Objects
$type string Field Type Identifier

Protected Properties

Property Type Description
$api PodsAPI API caching for fields that need it during validate/save

Public Methods

Method Description
__construct ( ) Setup related objects list
admin_ajax_relationship ( ) Handle autocomplete AJAX
admin_init ( ) Add admin_init actions
bidirectional_objects ( ) : array Return available bidirectional object names
data ( string $name, string | array $value = null, array $options = null, array $pod = null, integer $id = null, boolean $in_form = true ) : array Get the data from the field
data_capabilities ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array Data callback for User Capabilities
data_countries ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array Data callback for Countries
data_days_of_week ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array Data callback for US States
data_image_sizes ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array Data callback for Image Sizes
data_months_of_year ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array Data callback for US States
data_post_stati ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array Data callback for Post Stati
data_roles ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array Data callback for User Roles
data_us_states ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array Data callback for US States
delete ( integer $id = null, string $name = null, array $options = null, array $pod = null ) Delete the value from the DB
display ( mixed $value = null, string $name = null, array $options = null, array $pod = null, integer $id = null ) Change the way the value of the field is displayed with Pods::get
get_field_data ( array | string $field, array $options = [], array $object_params = [] ) : array Get available items from a relationship field
get_object_data ( array $object_params = null ) : array | boolean Get data from relationship objects
input ( string $name, mixed $value = null, array $options = null, array $pod = null, integer $id = null ) Customize output of the form field
options ( ) : array Add options and set defaults to
register_related_object ( string $name, string $label, array $options = null ) : array | boolean Register a related object
related_objects ( boolean $force = false ) : array Return available related objects
save ( 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
schema ( array $options = null ) : array Define the current field's schema for DB table storage
setup_related_objects ( boolean $force = false ) : boolean Setup related objects
simple_objects ( ) : array Return available simple object names
simple_value ( string $name, string | array $value = null, array $options = null, array $pod = null, integer $id = null, boolean $raw = false ) : mixed Convert a simple value to the correct value
ui ( integer $id, mixed $value, string $name = null, array $options = null, array $fields = null, array $pod = null ) Customize the Pods UI manage table column output
validate ( mixed $value, string $name = null, array $options = null, array $fields = null, array $pod = null, integer $id = null, null $params = null ) : array | boolean Validate a value before it's saved
value_to_label ( string $name, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : string Get the label from a pick value

Method Details

__construct() public method

Setup related objects list
Since: 2.0
public __construct ( )

admin_ajax_relationship() public method

Handle autocomplete AJAX
Since: 2.3

admin_init() public method

Add admin_init actions
Since: 2.3
public admin_init ( )

bidirectional_objects() public method

Return available bidirectional object names
Since: 2.3.4
public bidirectional_objects ( ) : array
return array Bidirectional object names

data() public method

Get the data from the field
Since: 2.0
public data ( string $name, string | array $value = null, array $options = null, array $pod = null, integer $id = null, boolean $in_form = true ) : array
$name string The name of the field
$value string | array The value of the field
$options array Field options
$pod array Pod data
$id integer Item ID
$in_form boolean
return array Array of possible field data

data_capabilities() public method

Data callback for User Capabilities
Since: 2.3
public data_capabilities ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array
$name string The name of the field
$value string | array The value of the field
$options array Field options
$pod array Pod data
$id integer Item ID
return array

data_countries() public method

Data callback for Countries
Since: 2.3
public data_countries ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array
$name string The name of the field
$value string | array The value of the field
$options array Field options
$pod array Pod data
$id integer Item ID
return array

data_days_of_week() public method

Data callback for US States
Since: 2.3
public data_days_of_week ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array
$name string The name of the field
$value string | array The value of the field
$options array Field options
$pod array Pod data
$id integer Item ID
return array

data_image_sizes() public method

Data callback for Image Sizes
Since: 2.3
public data_image_sizes ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array
$name string The name of the field
$value string | array The value of the field
$options array Field options
$pod array Pod data
$id integer Item ID
return array

data_months_of_year() public method

Data callback for US States
Since: 2.3
public data_months_of_year ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array
$name string The name of the field
$value string | array The value of the field
$options array Field options
$pod array Pod data
$id integer Item ID
return array

data_post_stati() public method

Data callback for Post Stati
Since: 2.3
public data_post_stati ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array
$name string The name of the field
$value string | array The value of the field
$options array Field options
$pod array Pod data
$id integer Item ID
return array

data_roles() public method

Data callback for User Roles
Since: 2.3
public data_roles ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array
$name string The name of the field
$value string | array The value of the field
$options array Field options
$pod array Pod data
$id integer Item ID
return array

data_us_states() public method

Data callback for US States
Since: 2.3
public data_us_states ( string $name = null, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : array
$name string The name of the field
$value string | array The value of the field
$options array Field options
$pod array Pod data
$id integer Item ID
return array

delete() public method

Delete the value from the DB
Since: 2.3
public delete ( integer $id = null, string $name = null, array $options = null, array $pod = null )
$id integer
$name string
$options array
$pod array

display() public method

Change the way the value of the field is displayed with Pods::get
Since: 2.0
public display ( mixed $value = null, string $name = null, array $options = null, array $pod = null, integer $id = null )
$value mixed
$name string
$options array
$pod array
$id integer

get_field_data() public method

Get available items from a relationship field
public get_field_data ( array | string $field, array $options = [], array $object_params = [] ) : array
$field array | string Field array or field name
$options array [optional] Field options array overrides
$object_params array [optional] Additional get_object_data options
return array An array of available items from a relationship field

get_object_data() public method

Get data from relationship objects
public get_object_data ( array $object_params = null ) : array | boolean
$object_params array Object data parameters
return array | boolean Object data

input() public method

Customize output of the form field
Since: 2.0
public input ( string $name, mixed $value = null, array $options = null, array $pod = null, integer $id = null )
$name string
$value mixed
$options array
$pod array
$id integer

options() public method

Add options and set defaults to
Since: 2.0
public options ( ) : array
return array

save() public method

Save the value to the DB
Since: 2.3
public save ( mixed $value, integer $id = null, string $name = null, array $options = null, array $fields = null, array $pod = null, object $params = null )
$value mixed
$id integer
$name string
$options array
$fields array
$pod array
$params object

schema() public method

Define the current field's schema for DB table storage
Since: 2.0
public schema ( array $options = null ) : array
$options array
return array

simple_objects() public method

Return available simple object names
Since: 2.3
public simple_objects ( ) : array
return array Simple object names

simple_value() public method

Convert a simple value to the correct value
public simple_value ( string $name, string | array $value = null, array $options = null, array $pod = null, integer $id = null, boolean $raw = false ) : mixed
$name string The name of the field
$value string | array The value of the field
$options array Field options
$pod array Pod data
$id integer Item ID
$raw boolean Whether to return the raw list of keys (true) or convert to key=>value (false)
return mixed Corrected value

ui() public method

Customize the Pods UI manage table column output
Since: 2.0
public ui ( integer $id, mixed $value, string $name = null, array $options = null, array $fields = null, array $pod = null )
$id integer
$value mixed
$name string
$options array
$fields array
$pod array

validate() public method

Validate a value before it's saved
Since: 2.0
public validate ( mixed $value, string $name = null, array $options = null, array $fields = null, array $pod = null, integer $id = null, null $params = null ) : array | boolean
$value mixed
$name string
$options array
$fields array
$pod array
$id integer
$params null
return array | boolean

value_to_label() public method

Get the label from a pick value
Since: 2.2
public value_to_label ( string $name, string | array $value = null, array $options = null, array $pod = null, integer $id = null ) : string
$name string The name of the field
$value string | array The value of the field
$options array Field options
$pod array Pod data
$id integer Item ID
return string

Property Details

$api protected static property

API caching for fields that need it during validate/save
Since: 2.3
protected static PodsAPI $api
return PodsAPI

$field_data public static property

Data used during input method (mainly for autocomplete)
Since: 2.3
public static array $field_data
return array

$group public static property

Field Type Group
Since: 2.0
public static string $group
return string

$label public static property

Field Type Label
Since: 2.0
public static string $label
return string

$type public static property

Field Type Identifier
Since: 2.0
public static string $type
return string