PHP Class Themosis\Page\PageBuilder

Inheritance: extends Themosis\Field\Wrapper
Datei anzeigen Open project: themosis/framework

Protected Properties

Property Type Description
$action Themosis\Hook\IHook
$datas Themosis\Foundation\DataContainer The page properties.
$sections array The page sections.
$settings array The page settings.
$validator Themosis\Validation\ValidationBuilder The page validator object.
$view Illuminate\View\View The page view file.

Public Methods

Method Description
__construct ( DataContainer $datas, Illuminate\View\View $view, ValidationBuilder $validator, Themosis\Hook\IHook $action ) Build a Page instance.
addSections ( array $sections = [] ) : PageBuilder Add custom sections for your settings.
addSettings ( array $settings = [] ) : PageBuilder Add settings to the page. Define settings per section by setting the 'key' name equal to a registered section and pass it an array of 'settings' fields.
build ( ) Triggered by the 'admin_menu' action event.
displayPage ( ) Triggered by the 'add_menu_page' or 'add_submenu_page'.
displaySections ( array $args ) Handle section display of the Settings API.
displaySettings ( mixed $setting ) Handle setting display of the Settings API.
enqueueMediaUploader ( ) Enqueue the WordPress media scripts.
get ( string $property = null ) : mixed Return a page property value.
hasSections ( ) : boolean Check if the page has sections.
installSettings ( ) Triggered by the 'admin_init' action.
make ( string $slug, string $title, string $parent = null, Illuminate\View\View $view = null ) : PageBuilder
renderSettings ( ) Helper method that output the page settings.
renderTabs ( ) Helper method that output the tab navigation if available.
set ( array $params = [] ) : PageBuilder Set the custom page. Allow user to override the default page properties and add its own properties.
validate ( array $rules = [] ) : PageBuilder Set validation rules to settings.
validateSettings ( mixed $values ) : array Validate the defined settings.
with ( string | array $key, mixed $value = null ) : PageBuilder Allow a user to pass custom datas to the page view instance.

Protected Methods

Method Description
getActiveTab ( ) : string Return the active tab slug of the settings page.
installWithTabs ( ) Register sections and settings in order to work with tabs.
installWithoutTabs ( ) Register sections and settings in a page.
isInfinite ( string $name ) : boolean Check if a field/settings is of type 'infinite'.
setTabUri ( string $default ) : string Define the tab URI. Check for extra query parameters.

Method Details

__construct() public method

Build a Page instance.
public __construct ( DataContainer $datas, Illuminate\View\View $view, ValidationBuilder $validator, Themosis\Hook\IHook $action )
$datas Themosis\Foundation\DataContainer The page properties.
$view Illuminate\View\View The page view file.
$validator Themosis\Validation\ValidationBuilder The page validator.
$action Themosis\Hook\IHook The Action builder class.

addSections() public method

Add custom sections for your settings.
public addSections ( array $sections = [] ) : PageBuilder
$sections array
return PageBuilder

addSettings() public method

Add settings to the page. Define settings per section by setting the 'key' name equal to a registered section and pass it an array of 'settings' fields.
public addSettings ( array $settings = [] ) : PageBuilder
$settings array The page settings.
return PageBuilder

build() public method

Register/display the custom page in the WordPress admin.
public build ( )

displayPage() public method

Triggered by the 'add_menu_page' or 'add_submenu_page'.
public displayPage ( )

displaySections() public method

Handle section display of the Settings API.
public displaySections ( array $args )
$args array

displaySettings() public method

Handle setting display of the Settings API.
public displaySettings ( mixed $setting )
$setting mixed

enqueueMediaUploader() public method

Make the 'wp' object available to javascript.

get() public method

Return a page property value.
public get ( string $property = null ) : mixed
$property string
return mixed

getActiveTab() protected method

Return the active tab slug of the settings page.
protected getActiveTab ( ) : string
return string

hasSections() public method

Check if the page has sections.
public hasSections ( ) : boolean
return boolean

installSettings() public method

Perform the WordPress settings API.
public installSettings ( )

installWithTabs() protected method

Register sections and settings in order to work with tabs.
protected installWithTabs ( )

installWithoutTabs() protected method

Register sections and settings in a page.
protected installWithoutTabs ( )

isInfinite() protected method

Check if a field/settings is of type 'infinite'.
protected isInfinite ( string $name ) : boolean
$name string The name of the field/setting.
return boolean

make() public method

public make ( string $slug, string $title, string $parent = null, Illuminate\View\View $view = null ) : PageBuilder
$slug string The page slug name.
$title string The page display title.
$parent string The parent's page slug if a subpage.
$view Illuminate\View\View The page main view file.
return PageBuilder

renderSettings() public method

Helper method that output the page settings.
public renderSettings ( )

renderTabs() public method

Helper method that output the tab navigation if available.
public renderTabs ( )

set() public method

Set the custom page. Allow user to override the default page properties and add its own properties.
public set ( array $params = [] ) : PageBuilder
$params array
return PageBuilder

setTabUri() protected method

Define the tab URI. Check for extra query parameters.
protected setTabUri ( string $default ) : string
$default string The default URI to check. Mainly look for query parameters.
return string

validate() public method

Set validation rules to settings.
public validate ( array $rules = [] ) : PageBuilder
$rules array
return PageBuilder

validateSettings() public method

Validate the defined settings.
public validateSettings ( mixed $values ) : array
$values mixed
return array

with() public method

Allow a user to pass custom datas to the page view instance.
public with ( string | array $key, mixed $value = null ) : PageBuilder
$key string | array
$value mixed
return PageBuilder

Property Details

$action protected_oe property

protected IHook,Themosis\Hook $action
return Themosis\Hook\IHook

$datas protected_oe property

The page properties.
protected DataContainer,Themosis\Foundation $datas
return Themosis\Foundation\DataContainer

$sections protected_oe property

The page sections.
protected array $sections
return array

$settings protected_oe property

The page settings.
protected array $settings
return array

$validator protected_oe property

The page validator object.
protected ValidationBuilder,Themosis\Validation $validator
return Themosis\Validation\ValidationBuilder

$view protected_oe property

The page view file.
protected View,Illuminate\View $view
return Illuminate\View\View