PHP Interface Themosis\Metabox\IMetabox

Show file Open project: themosis/framework Interface Usage Examples

Public Methods

Method Description
can ( string $capability ) : Themosis\Metabox\IMetabox Define a custom capability to check before adding the metabox.
make ( string $title, string $postType, array $options = [], Illuminate\View\View $view = null ) : Themosis\Metabox\IMetabox Build a metabox instance.
set ( array $fields = [] ) : Themosis\Metabox\IMetabox Register the metabox to WordPress.
validate ( array $rules = [] ) : Themosis\Metabox\IMetabox Define a list of validation rules to execute on metabox fields.
with ( string $key, mixed $value = null ) : Themosis\Metabox\IMetabox Pass custom data to the metabox view.

Method Details

can() public method

Define a custom capability to check before adding the metabox.
public can ( string $capability ) : Themosis\Metabox\IMetabox
$capability string
return Themosis\Metabox\IMetabox

make() public method

Build a metabox instance.
public make ( string $title, string $postType, array $options = [], Illuminate\View\View $view = null ) : Themosis\Metabox\IMetabox
$title string The metabox title
$postType string The post type name where the metabox is displayed
$options array Metabox parameters (id, context, priority,...)
$view Illuminate\View\View A custom view used by the metabox to render
return Themosis\Metabox\IMetabox

set() public method

Register the metabox to WordPress.
public set ( array $fields = [] ) : Themosis\Metabox\IMetabox
$fields array A list of custom fields to assign.
return Themosis\Metabox\IMetabox

validate() public method

Define a list of validation rules to execute on metabox fields.
public validate ( array $rules = [] ) : Themosis\Metabox\IMetabox
$rules array
return Themosis\Metabox\IMetabox

with() public method

Pass custom data to the metabox view.
public with ( string $key, mixed $value = null ) : Themosis\Metabox\IMetabox
$key string
$value mixed
return Themosis\Metabox\IMetabox