PHP 클래스 WPAS_Custom_Fields

저자: ThemeAvenue ([email protected])
파일 보기 프로젝트 열기: awesome-support/awesome-support 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$remove_mb List of metaboxes to remove.

공개 메소드들

메소드 설명
__construct ( )
add_custom_column ( array $columns ) : array Add possible custom columns to tickets list.
add_field ( string $name = '', array $args = [] ) : boolean Add a new custom field to the ticket.
check_required_fields ( $go, array $data = [] ) : mixed Checks required custom fields.
custom_column_orderby ( object $query ) : void Reorder custom columns based on custom values.
custom_columns_content ( string $column, integer $post_id ) : void Manage custom columns content
custom_columns_sortable ( array $columns ) : array Make custom columns sortable
custom_taxonomy_filter ( ) : void Add filters for custom taxonomies
custom_taxonomy_filter_convert_id_term ( object $query ) : void Convert taxonomy term ID into term slug.
enqueue_select2_assets ( ) : void Register and enqueue the select2 assets
frontend_submission ( integer $ticket_id ) : void Trigger the custom fields save function upon front-end submission of a new ticket.
get_custom_fields ( ) : array Return the list of fields
have_custom_fields ( boolean $core = false ) : boolean Check if custom fields are registered.
is_field_missing ( array $data = [] ) : boolean | WP_Error Makes sure no required custom field is missing from the data passed.
move_status_first ( array $columns ) : array Reorder the admin columns.
register_taxonomies ( ) : void Register all custom taxonomies.
remove_field ( string $id ) : void Remove a custom field.
remove_taxonomy_metabox ( ) : void Remove taxonomies metaboxes.
save_core_field ( integer $post_id, array $field, mixed $value ) : void Save the core fields.
save_custom_fields ( integer $post_id, array $data = [], boolean $allow_log = true ) : array Save all custom fields given in $data to the database.
status_filter ( ) : void Add status dropdown in the filters bar.
status_filter_by_status ( object $query ) : void Filter tickets by status.
submission_form_fields ( ) : void Display the custom fields on submission form.

메소드 상세

__construct() 공개 메소드

public __construct ( )

add_custom_column() 공개 메소드

Add possible custom columns to tickets list.
부터: 3.0.0
public add_custom_column ( array $columns ) : array
$columns array List of default columns
리턴 array Updated list of columns

add_field() 공개 메소드

Add a new custom field to the ticket.
부터: 3.0.0
public add_field ( string $name = '', array $args = [] ) : boolean
$name string Option name
$args array Field arguments
리턴 boolean Whether or not the field was added

check_required_fields() 공개 메소드

This function is hooked on the filter wpas_before_submit_new_ticket_checks through the parent class. It checks all required custom fields and if they were correctly filled. If one or more required field(s) is/are missing then the submission process is stopped and an error message is returned.
부터: 3.0.0
public check_required_fields ( $go, array $data = [] ) : mixed
$data array Array of data containing the custom fields to check for required attribute
리턴 mixed True if no error or a WP_Error otherwise

custom_column_orderby() 공개 메소드

Reorder custom columns based on custom values.
부터: 3.0.0
public custom_column_orderby ( object $query ) : void
$query object Main query
리턴 void

custom_columns_content() 공개 메소드

Manage custom columns content
부터: 3.0.0
public custom_columns_content ( string $column, integer $post_id ) : void
$column string The name of the column to display
$post_id integer ID of the post being processed
리턴 void

custom_columns_sortable() 공개 메소드

Make custom columns sortable
부터: 3.0.0
public custom_columns_sortable ( array $columns ) : array
$columns array Already sortable columns
리턴 array New sortable columns

custom_taxonomy_filter() 공개 메소드

Add filters for custom taxonomies
부터: 2.0.0
public custom_taxonomy_filter ( ) : void
리턴 void

custom_taxonomy_filter_convert_id_term() 공개 메소드

When filtering, WordPress uses the term ID by default in the query but that doesn't work. We need to convert it to the taxonomy term slug.
public custom_taxonomy_filter_convert_id_term ( object $query ) : void
$query object WordPress current main query
리턴 void

enqueue_select2_assets() 공개 메소드

This method will be called if the select2 parameter is passed with a custom field (could be a select or a taxonomy field).
부터: 3.3
public enqueue_select2_assets ( ) : void
리턴 void

frontend_submission() 공개 메소드

Trigger the custom fields save function upon front-end submission of a new ticket.
부터: 3.2.0
public frontend_submission ( integer $ticket_id ) : void
$ticket_id integer ID of the ticket that's just been added
리턴 void

get_custom_fields() 공개 메소드

Return the list of fields
부터: 3.0.0
public get_custom_fields ( ) : array
리턴 array List of custom fields

have_custom_fields() 공개 메소드

If there are registered custom fields, the method returns true. Core fields are not considered registered custom fields by default but that can be overridden with the $core parameter.
부터: 3.0.0
public have_custom_fields ( boolean $core = false ) : boolean
$core boolean True if core fields should be counted as registered custom fields.
리턴 boolean True if custom fields are present, false otherwise

is_field_missing() 공개 메소드

Makes sure no required custom field is missing from the data passed.
부터: 3.2.0
public is_field_missing ( array $data = [] ) : boolean | WP_Error
$data array Array of data to check
리턴 boolean | WP_Error False if no field is missing, WP_Error with the list of missing fields otherwise

move_status_first() 공개 메소드

Reorder the admin columns.
부터: 3.0.0
public move_status_first ( array $columns ) : array
$columns array List of admin columns
리턴 array Re-ordered list

register_taxonomies() 공개 메소드

Register all custom taxonomies.
부터: 3.0.0
public register_taxonomies ( ) : void
리턴 void

remove_field() 공개 메소드

Remove a custom field.
부터: 3.0.0
public remove_field ( string $id ) : void
$id string ID of the field to remove
리턴 void

remove_taxonomy_metabox() 공개 메소드

In some cases taxonomies are used as select. Hence, we don't need the standard taxonomy metabox.
부터: 3.0.0
public remove_taxonomy_metabox ( ) : void
리턴 void

save_core_field() 공개 메소드

Core fields are processed differently and won't use the same saving function as the standard custom fields of the same type.
부터: 3.2.0
public save_core_field ( integer $post_id, array $field, mixed $value ) : void
$post_id integer ID of the post being saved
$field array Field array
$value mixed Field new value
리턴 void

save_custom_fields() 공개 메소드

Save all custom fields given in $data to the database.
부터: 3.2.0
public save_custom_fields ( integer $post_id, array $data = [], boolean $allow_log = true ) : array
$post_id integer ID of the post being saved
$data array Array of data that might contain custom fields values.
$allow_log boolean Whether or not to allow logging actions. If this is set to false and the custom field is set to true, $log has higher priority. I tis used to prevent logging on ticket creation.
리턴 array Array of custom field / value saved to the database

status_filter() 공개 메소드

Add status dropdown in the filters bar.
부터: 2.0.0
public status_filter ( ) : void
리턴 void

status_filter_by_status() 공개 메소드

When filtering, WordPress uses the ID by default in the query but that doesn't work. We need to convert it to the taxonomy term.
부터: 3.0.0
public status_filter_by_status ( object $query ) : void
$query object WordPress current main query
리턴 void

submission_form_fields() 공개 메소드

Display the custom fields on submission form.
부터: 3.2.0
public submission_form_fields ( ) : void
리턴 void

프로퍼티 상세

$remove_mb 공개적으로 프로퍼티

List of metaboxes to remove.
public $remove_mb