PHP Class Papi_Property_Flexible, papi

Inheritance: extends Papi_Property_Repeater
Show file Open project: wp-papi/papi

Public Properties

Property Type Description
$convert_type string The convert type.
$default_value array The default value.

Protected Properties

Property Type Description
$counter integer Flexible repeater counter number.
$exclude_properties array Exclude properties that is not allowed in a repeater.
$layout_key string The layout key.
$layout_value_regex string Layout value regex.

Public Methods

Method Description
delete_value ( string $slug, integer $post_id, string $type ) : boolean Delete value from the database.
format_value ( mixed $values, string $repeater_slug, integer $post_id ) : array Format the value of the property before it's returned to WordPress admin or the site.
load_value ( mixed $value, string $repeater_slug, integer $post_id ) : array Change value after it's loaded from the database and populate every property in the flexible with the right property type.
render_ajax_request ( ) Render AJAX request.
render_repeater_row_template ( ) Render repeater row template.

Protected Methods

Method Description
get_json_id ( string $key, string $extra = '' ) : string Generate layout slug.
get_layout ( string $slug ) : string Get layout by slug.
get_layout_value ( string $layout ) : string Get layout value.
get_results ( integer $value, string $repeater_slug, integer $post_id ) : array Get results from the database.
get_settings_layouts ( ) : array Get layouts.
is_layout_key ( string $key ) : boolean Check if the given key is a valid layout key.
prepare_properties ( array $layouts ) : array Prepare properties.
render_json_template ( string $slug ) Render layout JSON template.
render_layout_input ( string $value ) Render layout input.
render_properties ( array $row, array | boolean $value ) Render properties.
render_repeater ( object $options ) Render repeater html.
render_repeater_row ( ) Render repeater row.
setup_actions ( ) Setup actions.
valid_layout ( array $layout ) : boolean Check if the layout is valid or not.

Method Details

delete_value() public method

Delete value from the database.
public delete_value ( string $slug, integer $post_id, string $type ) : boolean
$slug string
$post_id integer
$type string
return boolean

format_value() public method

Format the value of the property before it's returned to WordPress admin or the site.
public format_value ( mixed $values, string $repeater_slug, integer $post_id ) : array
$values mixed
$repeater_slug string
$post_id integer
return array

get_json_id() protected method

Generate layout slug.
protected get_json_id ( string $key, string $extra = '' ) : string
$key string
$extra string
return string

get_layout() protected method

Get layout by slug.
protected get_layout ( string $slug ) : string
$slug string
return string

get_layout_value() protected method

Get layout value.
protected get_layout_value ( string $layout ) : string
$layout string
return string

get_results() protected method

Get results from the database.
protected get_results ( integer $value, string $repeater_slug, integer $post_id ) : array
$value integer
$repeater_slug string
$post_id integer
return array

get_settings_layouts() protected method

Get layouts.
protected get_settings_layouts ( ) : array
return array

is_layout_key() protected method

Check if the given key is a valid layout key.
protected is_layout_key ( string $key ) : boolean
$key string
return boolean

load_value() public method

Change value after it's loaded from the database and populate every property in the flexible with the right property type.
public load_value ( mixed $value, string $repeater_slug, integer $post_id ) : array
$value mixed
$repeater_slug string
$post_id integer
return array

prepare_properties() protected method

Not the best name for this function, but since property repeater using this we can't rename it.
protected prepare_properties ( array $layouts ) : array
$layouts array
return array

render_ajax_request() public method

Render AJAX request.
public render_ajax_request ( )

render_json_template() protected method

Render layout JSON template.
protected render_json_template ( string $slug )
$slug string

render_layout_input() protected method

Render layout input.
protected render_layout_input ( string $value )
$value string

render_properties() protected method

Render properties.
protected render_properties ( array $row, array | boolean $value )
$row array
$value array | boolean

render_repeater() protected method

Render repeater html.
protected render_repeater ( object $options )
$options object

render_repeater_row() protected method

Render repeater row.
protected render_repeater_row ( )

render_repeater_row_template() public method

Render repeater row template.

setup_actions() protected method

Setup actions.
protected setup_actions ( )

valid_layout() protected method

Check if the layout is valid or not.
protected valid_layout ( array $layout ) : boolean
$layout array
return boolean

Property Details

$convert_type public property

The convert type.
public string $convert_type
return string

$counter protected property

Flexible repeater counter number.
protected int $counter
return integer

$default_value public property

The default value.
public array $default_value
return array

$exclude_properties protected property

Exclude properties that is not allowed in a repeater.
protected array $exclude_properties
return array

$layout_key protected property

The layout key.
protected string $layout_key
return string

$layout_value_regex protected property

Layout value regex.
protected string $layout_value_regex
return string