PHP Class Themosis\PostType\PostTypeBuilder

Inheritance: implements Themosis\PostType\IPostType
Afficher le fichier Open project: themosis/framework

Protected Properties

Свойство Type Description
$action Themosis\Hook\IHook
$container Themosis\Foundation\Application Application container.
$datas Themosis\Foundation\DataContainer PostTypeData instance.
$filter Themosis\Hook\IHook
$metabox Themosis\Metabox\IMetabox The custom publish metabox.
$postType object | WP_Error The registered custom post type.
$prefix string Instance abstract name prefix for registration into the container.
$status array The custom statuses.
$view Illuminate\View\View The custom view used for publish metabox.

Méthodes publiques

Méthode Description
__construct ( Application $container, DataContainer $datas, Themosis\Metabox\IMetabox $metabox, Illuminate\View\View $view, Themosis\Hook\IHook $action, Themosis\Hook\IHook $filter ) Build a custom post type.
applyStatus ( string $value ) : mixed Apply the selected status to the post on save.
get ( null $property = null ) : array Return a defined post type property.
has_status ( ) : boolean Check if the custom post type has statuses registered.
instance ( ) : stdClass | WP_Post_type Return the WordPress post type instance.
make ( string $name, string $plural, string $singular ) : PostTypeBuilder Define a new custom post type.
register ( ) Triggered by the 'init' action event.
removeDefaultPublishBox ( ) Remove default publish metabox from the custom post type edit screen.
reorderStatusViews ( array $views ) : array Re-order the status views/links on top of the List Table.
set ( array $params = [] ) : PostTypeBuilder Set the custom post type. A user can also override the arguments by passing an array of custom post type arguments.
setTitle ( string $title ) : PostTypeBuilder Allow a user to change the title placeholder text.
status ( array | string $status, array $args = [] ) : PostTypeBuilder Add custom post type status.

Méthodes protégées

Méthode Description
exposeStatuses ( ) Handle output of custom statuses to admin JS object.
setDefaultArguments ( string $plural, string $singular ) : array Set the custom post type default arguments.

Method Details

__construct() public méthode

Build a custom post type.
public __construct ( Application $container, DataContainer $datas, Themosis\Metabox\IMetabox $metabox, Illuminate\View\View $view, Themosis\Hook\IHook $action, Themosis\Hook\IHook $filter )
$container Themosis\Foundation\Application The application container.
$datas Themosis\Foundation\DataContainer The post type properties.
$metabox Themosis\Metabox\IMetabox The custom metabox for custom publish metabox
$view Illuminate\View\View The view that handles custom publish metabox
$action Themosis\Hook\IHook The action class
$filter Themosis\Hook\IHook The filter class

applyStatus() public méthode

Apply the selected status to the post on save.
public applyStatus ( string $value ) : mixed
$value string The translated value by WordPress (is always "publish" for some reasons.)
Résultat mixed

exposeStatuses() protected méthode

Handle output of custom statuses to admin JS object.
protected exposeStatuses ( )

get() public méthode

Return a defined post type property.
public get ( null $property = null ) : array
$property null
Résultat array

has_status() public méthode

Check if the custom post type has statuses registered.
public has_status ( ) : boolean
Résultat boolean

instance() public méthode

Return the WordPress post type instance.
public instance ( ) : stdClass | WP_Post_type
Résultat stdClass | WP_Post_type if WordPress 4.6+

make() public méthode

Define a new custom post type.
public make ( string $name, string $plural, string $singular ) : PostTypeBuilder
$name string The post type slug name.
$plural string The post type plural name for display.
$singular string The post type singular name for display.
Résultat PostTypeBuilder

register() public méthode

Register a WordPress custom post type.
public register ( )

removeDefaultPublishBox() public méthode

Remove default publish metabox from the custom post type edit screen.

reorderStatusViews() public méthode

If there is a 'trash' view, move it to last position for better user experience.
public reorderStatusViews ( array $views ) : array
$views array The statuses views.
Résultat array

set() public méthode

Set the custom post type. A user can also override the arguments by passing an array of custom post type arguments.
public set ( array $params = [] ) : PostTypeBuilder
$params array The custom post type arguments.
Résultat PostTypeBuilder

setDefaultArguments() protected méthode

Set the custom post type default arguments.
protected setDefaultArguments ( string $plural, string $singular ) : array
$plural string The post type plural display name.
$singular string The post type singular display name.
Résultat array

setTitle() public méthode

Allow a user to change the title placeholder text.
public setTitle ( string $title ) : PostTypeBuilder
$title string The title placeholder text.
Résultat PostTypeBuilder

status() public méthode

Add custom post type status.
public status ( array | string $status, array $args = [] ) : PostTypeBuilder
$status array | string The status key name.
$args array The status arguments.
Résultat PostTypeBuilder

Property Details

$action protected_oe property

protected IHook,Themosis\Hook $action
Résultat Themosis\Hook\IHook

$container protected_oe property

Application container.
protected Application,Themosis\Foundation $container
Résultat Themosis\Foundation\Application

$datas protected_oe property

PostTypeData instance.
protected DataContainer,Themosis\Foundation $datas
Résultat Themosis\Foundation\DataContainer

$filter protected_oe property

protected IHook,Themosis\Hook $filter
Résultat Themosis\Hook\IHook

$metabox protected_oe property

The custom publish metabox.
protected IMetabox,Themosis\Metabox $metabox
Résultat Themosis\Metabox\IMetabox

$postType protected_oe property

The registered custom post type.
protected object|WP_Error $postType
Résultat object | WP_Error

$prefix protected_oe property

Instance abstract name prefix for registration into the container.
protected string $prefix
Résultat string

$status protected_oe property

The custom statuses.
protected array $status
Résultat array

$view protected_oe property

The custom view used for publish metabox.
protected View,Illuminate\View $view
Résultat Illuminate\View\View