PHP Класс Carbon_Fields\Field\Association_Field

Allows selecting and manually sorting entries from various types: - Posts - Terms - Users - Comments
Наследование: extends Relationship_Field
Показать файл Открыть проект

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

Свойство Тип Описание
$types array Types of entries to associate with.

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

Метод Описание
get_item_label ( integer $id, string $type, string $subtype = '' ) : string Used to get the label of an item.
get_object_edit_link ( string $type, integer $id ) : string Retrieve the edit link of a particular object.
get_options ( ) : array Generate the item options for the relationship field.
get_title_by_type ( integer $id, string $type, string $subtype = '' ) : string Used to get the title of an item.
item_template ( boolean $display_input = true ) Serves as a backbone template for the relationship items.
process_value ( ) Converts the database values into a usable associative array.
set_post_type ( string $post_type ) Deprecated way to set the types.
set_types ( array $types ) Modify the types.
to_json ( boolean $load ) : mixed Convert the field data into JSON representation.

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

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

Can be overriden or extended by the carbon_relationship_item_label filter.
public get_item_label ( integer $id, string $type, string $subtype = '' ) : string
$id integer The database ID of the item.
$type string Item type (post, term, user, comment, or a custom one).
$subtype string Subtype - "page", "post", "category", etc.
Результат string $label The label of the item.

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

Generate the item options for the relationship field.
public get_options ( ) : array
Результат array $options The selectable options of the relationship field.

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

Can be overriden or extended by the carbon_relationship_title filter.
public get_title_by_type ( integer $id, string $type, string $subtype = '' ) : string
$id integer The database ID of the item.
$type string Item type (post, term, user, comment, or a custom one).
$subtype string The subtype - "page", "post", "category", etc.
Результат string $title The title of the item.

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

Used for both the selected and the selectable options.
public item_template ( boolean $display_input = true )
$display_input boolean Whether to display the selected item input field.

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

The relationship data is saved in the database in the following format: array ( 0 => 'post:page:4', 1 => 'term:category:2', 2 => 'user:user:1', ) where the value of each array item contains: - Type of data (post, term, user or comment) - Subtype of data (the particular post type or taxonomy) - ID of the item (the database ID of the item)
public process_value ( )

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

Works only for post types.
См. также: set_types()
Устаревший:
public set_post_type ( string $post_type )
$post_type string Post type

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

Modify the types.
public set_types ( array $types )
$types array New types

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

Convert the field data into JSON representation.
public to_json ( boolean $load ) : mixed
$load boolean Whether to load data from the datastore.
Результат mixed The JSON field data.

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

$types защищенное свойство

Types of entries to associate with.
protected array $types
Результат array