PHP Class WDS_CMB2_Attached_Posts_Field

Show file Open project: webdevstudios/cmb2-attached-posts Class Usage Examples

Protected Properties

Property Type Description
$single_instance WDS_CMB2_Attached_Posts_Field

Public Methods

Method Description
get_instance ( ) : WDS_CMB2_Attached_Posts_Field Creates or returns an instance of this class.
render ( $field, $escaped_value, $object_id, $object_type, $field_type ) Add a CMB custom field to allow for the selection of multiple posts attached to a single page
sanitize ( $sanitized_val, $val )

Protected Methods

Method Description
__construct ( ) Initialize the plugin by hooking into CMB2
display_attached ( $field, $attached ) Helper function to grab and filter our post meta
setup_admin_scripts ( ) Enqueue admin scripts for our attached posts field

Method Details

__construct() protected method

Initialize the plugin by hooking into CMB2
protected __construct ( )

display_attached() protected method

Helper function to grab and filter our post meta
protected display_attached ( $field, $attached )

get_instance() public static method

Creates or returns an instance of this class.
Since: 0.1.0
public static get_instance ( ) : WDS_CMB2_Attached_Posts_Field
return WDS_CMB2_Attached_Posts_Field A single instance of this class.

render() public method

Add a CMB custom field to allow for the selection of multiple posts attached to a single page
public render ( $field, $escaped_value, $object_id, $object_type, $field_type )

sanitize() public method

public sanitize ( $sanitized_val, $val )

setup_admin_scripts() protected method

Enqueue admin scripts for our attached posts field
protected setup_admin_scripts ( )

Property Details

$single_instance protected static property

protected static WDS_CMB2_Attached_Posts_Field $single_instance
return WDS_CMB2_Attached_Posts_Field