PHP 클래스 RWMB_Field

파일 보기 프로젝트 열기: rilwis/meta-box 1 사용 예제들

공개 메소드들

메소드 설명
add_actions ( ) Add actions
admin_enqueue_scripts ( ) Enqueue scripts and styles
begin_html ( mixed $meta, array $field ) : string Show begin HTML markup for fields
call ( ) : mixed Call a method of a field.
end_html ( mixed $meta, array $field ) : string Show end HTML markup for fields
esc_meta ( mixed $meta ) : mixed Escape meta for field output
filter ( ) : mixed Apply various filters based on field type, id.
format_single_value ( array $field, string $value ) : string Format a single value for the helper functions. Sub-fields should overwrite this method if necessary.
format_value ( array $field, string | array $value ) : string Format value for the helper functions.
get_attributes ( array $field, mixed $value = null ) : array Get the attributes for a field
get_class_name ( array $field ) : string Get field class name
get_value ( array $field, array $args = [], integer | null $post_id = null ) : mixed Get the field value The difference between this function and 'meta' function is 'meta' function always returns the escaped value of the field saved in the database, while this function returns more meaningful value of the field, for ex.: for file/image: return array of file/image information instead of file/image IDs
html ( mixed $meta, array $field ) : string Get field HTML
localize_script ( string $handle, string $name, mixed $data ) Localize scripts with prevention of loading localized data twice.
map_types ( array $field ) : string Map types
meta ( integer $post_id, boolean $saved, array $field ) : mixed Get meta value
normalize ( array $field ) : array Normalize parameters for field
raw_meta ( integer $post_id, array $field ) : mixed Get raw meta value
render_attributes ( array $attributes ) : string Renders an attribute array into an html attributes string
save ( $new, $old, $post_id, $field ) Save meta value
show ( array $field, boolean $saved ) Show field HTML Filters are put inside this method, not inside methods such as "meta", "html", "begin_html", etc.
the_value ( array $field, array $args = [], integer | null $post_id = null ) : string Output the field value Depends on field value and field types, each field can extend this method to output its value in its own way See specific field classes for details.
value ( mixed $new, mixed $old, integer $post_id, array $field ) : integer Set value of meta before saving into database

보호된 메소드들

메소드 설명
element_description ( array $field ) : string Display field description.

메소드 상세

add_actions() 공개 정적인 메소드

Add actions
public static add_actions ( )

admin_enqueue_scripts() 공개 정적인 메소드

Enqueue scripts and styles
public static admin_enqueue_scripts ( )

begin_html() 공개 정적인 메소드

Show begin HTML markup for fields
public static begin_html ( mixed $meta, array $field ) : string
$meta mixed
$field array
리턴 string

call() 공개 정적인 메소드

This should be replaced by static::$method( $args ) in PHP 5.3.
public static call ( ) : mixed
리턴 mixed

element_description() 보호된 정적인 메소드

Display field description.
protected static element_description ( array $field ) : string
$field array
리턴 string

end_html() 공개 정적인 메소드

Show end HTML markup for fields
public static end_html ( mixed $meta, array $field ) : string
$meta mixed
$field array
리턴 string

esc_meta() 공개 정적인 메소드

Escape meta for field output
public static esc_meta ( mixed $meta ) : mixed
$meta mixed
리턴 mixed

filter() 공개 정적인 메소드

Filters: - rwmb_{$name} - rwmb_{$field['type']}_{$name} - rwmb_{$field['id']}_{$name}
public static filter ( ) : mixed
리턴 mixed

format_single_value() 공개 정적인 메소드

Format a single value for the helper functions. Sub-fields should overwrite this method if necessary.
public static format_single_value ( array $field, string $value ) : string
$field array Field parameter
$value string The value
리턴 string

format_value() 공개 정적인 메소드

Format value for the helper functions.
public static format_value ( array $field, string | array $value ) : string
$field array Field parameter
$value string | array The field meta value
리턴 string

get_attributes() 공개 정적인 메소드

Get the attributes for a field
public static get_attributes ( array $field, mixed $value = null ) : array
$field array
$value mixed
리턴 array

get_class_name() 공개 정적인 메소드

Get field class name
public static get_class_name ( array $field ) : string
$field array Field array
리턴 string Field class name

get_value() 공개 정적인 메소드

Each field can extend this function and add more data to the returned value. See specific field classes for details.
public static get_value ( array $field, array $args = [], integer | null $post_id = null ) : mixed
$field array Field parameters
$args array Additional arguments. Rarely used. See specific fields for details
$post_id integer | null Post ID. null for current post. Optional.
리턴 mixed Field value

html() 공개 정적인 메소드

Get field HTML
public static html ( mixed $meta, array $field ) : string
$meta mixed
$field array
리턴 string

localize_script() 공개 정적인 메소드

Localize scripts with prevention of loading localized data twice.
public static localize_script ( string $handle, string $name, mixed $data )
$handle string Script handle.
$name string Object name.
$data mixed Localized data.

map_types() 공개 정적인 메소드

Map types
public static map_types ( array $field ) : string
$field array Field array
리턴 string Field mapped type

meta() 공개 정적인 메소드

Get meta value
public static meta ( integer $post_id, boolean $saved, array $field ) : mixed
$post_id integer
$saved boolean
$field array
리턴 mixed

normalize() 공개 정적인 메소드

Normalize parameters for field
public static normalize ( array $field ) : array
$field array
리턴 array

raw_meta() 공개 정적인 메소드

Get raw meta value
public static raw_meta ( integer $post_id, array $field ) : mixed
$post_id integer
$field array
리턴 mixed

render_attributes() 공개 정적인 메소드

Renders an attribute array into an html attributes string
public static render_attributes ( array $attributes ) : string
$attributes array
리턴 string

save() 공개 정적인 메소드

Save meta value
public static save ( $new, $old, $post_id, $field )
$new
$old
$post_id
$field

show() 공개 정적인 메소드

That ensures the returned value are always been applied filters This method is not meant to be overwritten in specific fields
public static show ( array $field, boolean $saved )
$field array
$saved boolean

the_value() 공개 정적인 메소드

Note: we don't echo the field value directly. We return the output HTML of field, which will be used in rwmb_the_field function later.
또한 보기: rwmb_the_value()
public static the_value ( array $field, array $args = [], integer | null $post_id = null ) : string
$field array Field parameters
$args array Additional arguments. Rarely used. See specific fields for details
$post_id integer | null Post ID. null for current post. Optional.
리턴 string HTML output of the field

value() 공개 정적인 메소드

Set value of meta before saving into database
public static value ( mixed $new, mixed $old, integer $post_id, array $field ) : integer
$new mixed
$old mixed
$post_id integer
$field array
리턴 integer