PHP Class Papi_Property_Repeater, papi

Inheritance: extends Papi_Property
显示文件 Open project: wp-papi/papi Class Usage Examples

Public Properties

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

Protected Properties

Property Type Description
$counter integer Repeater counter number.
$exclude_properties array Exclude properties that is not allowed in a repeater.

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.
get_default_settings ( ) : array Get default settings.
get_import_settings ( ) : array Get import settings.
html ( ) Render property html.
import_value ( mixed $value, string $slug, integer $post_id ) : array Import value to the property.
load_value ( integer $value, string $repeater_slug, integer $post_id ) : array Change value after it's loaded from the database and populate every property in the repeater with the right property type.
render_ajax_request ( ) Render AJAX request.
render_repeater_rows_template ( ) Render repeater row template.
update_value ( mixed $values, string $repeater_slug, integer $post_id ) : array Update value before it's saved to the database.

Protected Methods

Method Description
get_child_slug ( string $repeater_slug, string $child_slug ) : string Get child slug from the repeater slug.
get_results ( integer $value, string $repeater_slug, integer $post_id ) : array Get results from the database.
get_row_results ( array $dbresults ) : array Get row results.
get_settings_properties ( ) : array Get settings properties.
layout ( string $layout ) : boolean Check if the given layout is the layouted used.
load_child_properties ( array $results, Papi_Core_Property $property = null ) : array Load child properties.
prepare_properties ( array $items ) : array Prepare properties, get properties options object, check which properties that are allowed to use.
prepare_property_for_json ( Papi_Property $property ) : boolean | object Prepare property for JSON.
remove_repeater_rows ( integer $post_id, string $repeater_slug ) Remove all repeater rows from the database.
render_json_template ( string $slug ) Render property JSON template.
render_properties ( array $row, array | boolean $value ) Render properties.
render_repeater ( stdClass $options ) Render repeater html.
render_repeater_head ( ) Render repeater head.
render_repeater_rows ( ) Render repeater rows.
setup_actions ( ) Setup actions.

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_child_slug() protected method

Get child slug from the repeater slug.
protected get_child_slug ( string $repeater_slug, string $child_slug ) : string
$repeater_slug string
$child_slug string
return string

get_default_settings() public method

Get default settings.
public get_default_settings ( ) : array
return array

get_import_settings() public method

Get import settings.
public get_import_settings ( ) : array
return array

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_row_results() protected method

Get row results.
protected get_row_results ( array $dbresults ) : array
$dbresults array
return array

get_settings_properties() protected method

Get settings properties.
protected get_settings_properties ( ) : array
return array

html() public method

Render property html.
public html ( )

import_value() public method

Import value to the property.
public import_value ( mixed $value, string $slug, integer $post_id ) : array
$value mixed
$slug string
$post_id integer
return array

layout() protected method

Check if the given layout is the layouted used.
protected layout ( string $layout ) : boolean
$layout string
return boolean

load_child_properties() protected method

Load child properties.
protected load_child_properties ( array $results, Papi_Core_Property $property = null ) : array
$results array
$property Papi_Core_Property
return array

load_value() public method

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

prepare_properties() protected method

Prepare properties, get properties options object, check which properties that are allowed to use.
protected prepare_properties ( array $items ) : array
$items array
return array

prepare_property_for_json() protected method

Prepare property for JSON.
protected prepare_property_for_json ( Papi_Property $property ) : boolean | object
$property Papi_Property
return boolean | object

remove_repeater_rows() protected method

Remove all repeater rows from the database.
protected remove_repeater_rows ( integer $post_id, string $repeater_slug )
$post_id integer
$repeater_slug string

render_ajax_request() public method

Render AJAX request.
public render_ajax_request ( )

render_json_template() protected method

Render property JSON template.
protected render_json_template ( string $slug )
$slug 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 ( stdClass $options )
$options stdClass

render_repeater_head() protected method

Render repeater head.
protected render_repeater_head ( )

render_repeater_rows() protected method

Render repeater rows.
protected render_repeater_rows ( )

render_repeater_rows_template() public method

Render repeater row template.

setup_actions() protected method

Setup actions.
protected setup_actions ( )

update_value() public method

Update value before it's saved to the database.
public update_value ( mixed $values, string $repeater_slug, integer $post_id ) : array
$values mixed
$repeater_slug string
$post_id integer
return array

Property Details

$convert_type public_oe property

The convert type.
public string $convert_type
return string

$counter protected_oe property

Repeater counter number.
protected int $counter
return integer

$default_value public_oe property

The default value.
public array $default_value
return array

$exclude_properties protected_oe property

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