PHP 클래스 Fieldmanager_Options, vip-mu-plugins-public

상속: extends Fieldmanager_Field
파일 보기 프로젝트 열기: Automattic/vip-mu-plugins-public 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$data array Full option data, allows grouping
$first_element array Always prepend this element to the $data
$grouped boolean Is the data grouped? E.g. should we use
$multiple boolean Allow multiple selections?
$options array Shortcut to data which allows a simple associative array
$options_template string Path to an options template to load.

공개 메소드들

메소드 설명
__construct ( string $label = '', mixed $options = [] ) Add CSS, construct parent
add_options ( array $options ) : void Add options
form_data_element ( $data_row, mixed $value ) A single element for a single bit of data, e.g. '
form_data_elements ( mixed $value ) : string Generate form elements.
option_selected ( string $current_option, array $options, string $attribute ) : string Helper for output functions to toggle a selected options
preload_alter_values ( array $values ) Alter values before rendering
presave ( mixed $value, $current_value = [] ) : sanitized Presave function, which handles sanitization and validation
presave_all ( $values, $current_values ) : mixed[] Override presave_all to handle special cases associated with multiple options fields.
presave_alter_values ( int[] $values, int[] $current_values = [] ) : int[] Presave hook to set taxonomy data, maybe
sanitize ( array | string $value ) : array | string Sanitize function that can handle arrays as well as string values.

보호된 메소드들

메소드 설명
add_meta_boxes_to_remove ( &$meta_boxes_to_remove ) : array Helper function to get the list of default meta boxes to remove.
add_option_data ( string $name, mixed $value, string $group = null, string | integer $group_id = null ) : void Add option data to the data attribute of this object

메소드 상세

__construct() 공개 메소드

Add CSS, construct parent
public __construct ( string $label = '', mixed $options = [] )
$label string
$options mixed

add_meta_boxes_to_remove() 보호된 메소드

If $remove_default_meta_boxes is true and the datasource is Fieldmanager_Datasource_Term, this will return a list of all default meta boxes for the specified taxonomies. We only need to return id and context since the page will be handled by the list of post types provided to add_meta_box. Otherwise, this will just return an empty array.
protected add_meta_boxes_to_remove ( &$meta_boxes_to_remove ) : array
리턴 array list of meta boxes to remove

add_option_data() 보호된 메소드

Add option data to the data attribute of this object
protected add_option_data ( string $name, mixed $value, string $group = null, string | integer $group_id = null ) : void
$name string
$value mixed
$group string
$group_id string | integer
리턴 void

add_options() 공개 메소드

Add options
public add_options ( array $options ) : void
$options array
리턴 void

form_data_element() 공개 메소드

A single element for a single bit of data, e.g. '
public form_data_element ( $data_row, mixed $value )
$value mixed

form_data_elements() 공개 메소드

Generate form elements.
public form_data_elements ( mixed $value ) : string
$value mixed
리턴 string HTML

option_selected() 공개 메소드

Helper for output functions to toggle a selected options
public option_selected ( string $current_option, array $options, string $attribute ) : string
$current_option string this option
$options array all valid options
$attribute string
리턴 string $attribute on match, empty on failure.

preload_alter_values() 공개 메소드

Alter values before rendering
public preload_alter_values ( array $values )
$values array

presave() 공개 메소드

Presave function, which handles sanitization and validation
public presave ( mixed $value, $current_value = [] ) : sanitized
$value mixed If a single field expects to manage an array, it must override presave()
리턴 sanitized values.

presave_all() 공개 메소드

Override presave_all to handle special cases associated with multiple options fields.
public presave_all ( $values, $current_values ) : mixed[]
리턴 mixed[] sanitized values

presave_alter_values() 공개 메소드

Presave hook to set taxonomy data, maybe
public presave_alter_values ( int[] $values, int[] $current_values = [] ) : int[]
$values int[]
$current_values int[]
리턴 int[] $values

sanitize() 공개 메소드

Sanitize function that can handle arrays as well as string values.
public sanitize ( array | string $value ) : array | string
$value array | string
리턴 array | string Sanitized $value

프로퍼티 상세

$data 공개적으로 프로퍼티

Full option data, allows grouping
public array $data
리턴 array

$first_element 공개적으로 프로퍼티

Always prepend this element to the $data
public array $first_element
리턴 array

$grouped 공개적으로 프로퍼티

Is the data grouped? E.g. should we use
public bool $grouped
리턴 boolean

$multiple 공개적으로 프로퍼티

Allow multiple selections?
public bool $multiple
리턴 boolean

$options 공개적으로 프로퍼티

Shortcut to data which allows a simple associative array
public array $options
리턴 array

$options_template 공개적으로 프로퍼티

Path to an options template to load.
public string $options_template
리턴 string