\Dewdrop\Admin\Page\StockDebugPages

This page provides a full listing of a component's available pages. Pages in Dewdrop admin components are provided by PageFactory objects. One factory can override a page from another factory by responding to the same page name.

If a page is overridden (for example, you provide an Index page file even though the Crud page factory would also provide and Index), the superseded page will be crossed-out.

Summary

Methods
Properties
Constants
renderView()
__construct()
createStockPage()
init()
shouldProcess()
process()
render()
url()
createResponseHelper()
getView()
setName()
getName()
No public properties found
No constants found
inflectViewScriptName()
$component
$view
$request
$viewScriptPath
N/A
stockSubclassHasViewScript()
getClassLocation()
$classLocation
$name
N/A

Properties

$view

$view : \Dewdrop\View\View

A view object available for rendering. Generally, your page should not be rendering any output directly, but instead passing information from models to the view and then rendering the view.

Type

\Dewdrop\View\View

$request

$request : \Dewdrop\Request

An object representing the current HTTP request. The is primarily around to make it easier to test your pages by injecting POST and GET data into the request object.

Type

\Dewdrop\Request

$viewScriptPath

$viewScriptPath : string

The path where this page's view script should be found.

Type

string

$classLocation

$classLocation : string

Type

string

$name

$name : string

The name used in the URL to route to this page.

Type

string

Methods

renderView()

renderView() : string

You can call renderView() directly from your render() method. Or, if your render method produces no output itself, the component will call this method itself to automatically render your view script.

Returns

string

__construct()

__construct(\Dewdrop\Admin\Component\ComponentInterface  $component, \Dewdrop\Request  $request, string  $viewScriptPath = null) 

Create a new page with a reference to its component and the file in which it is defined.

Also, by default, the page will be configured to look for view scripts in the view-scripts sub-folder of its component.

Parameters

\Dewdrop\Admin\Component\ComponentInterface $component
\Dewdrop\Request $request
string $viewScriptPath

createStockPage()

createStockPage(  $name) 

Parameters

$name

init()

init() : void

Create any resources that need to be accessible both for processing and rendering.

shouldProcess()

shouldProcess() : boolean

Whether this page's process method should be called. By default, process() is always called, but sub-classes like EditAbstract can alter that logic to make other common patterns easier to support.

Returns

boolean

process()

process(\Dewdrop\Admin\ResponseHelper\Standard  $response) 

Perform any processing or data manipulation needed before render.

A response helper object will be passed to this method to allow you to easily add success messages or redirects. This helper should be used to handle these kinds of actions so that you can easily test your page's code.

Parameters

\Dewdrop\Admin\ResponseHelper\Standard $response

render()

render() 

Pass all the page factories for this component into the view.

url()

url(string  $page, array  $params = array()) : string

As the component this page belongs to for a URL matching the provided page and query string parameters. This method should always be used for generating URLs in your components so that it will play nicely with various WP integration points like submenus.

Parameters

string $page
array $params

Returns

string

createResponseHelper()

createResponseHelper(callable  $redirector) : \Dewdrop\Admin\ResponseHelper\Standard

Create a response helper object for this page.

If your page would benefit from an alternative response helper with additional methods relevant to your use case, you can override this method and the helper will be injected into the page's process() method rather than the standard helper created in PageAbstract.

Parameters

callable $redirector

Returns

\Dewdrop\Admin\ResponseHelper\Standard

getView()

getView() : \Dewdrop\View\View

Get a reference to this page's view object.

Returns

\Dewdrop\View\View

setName()

setName(string  $name) : $this

Set the name used in the URL to route to this page.

Parameters

string $name

Returns

$this

getName()

getName() : string

Set the name used in the URL to route to this page.

Returns

string

inflectViewScriptName()

inflectViewScriptName() : string

Determine the view script name for this page by inflecting the page class name to all lower case with the words separated by hyphens.

For example, the following class name:

Admin\MyComponent\Index

Would become:

index.phtml

Returns

string

stockSubclassHasViewScript()

stockSubclassHasViewScript(  $scriptFilename) 

Parameters

$scriptFilename

getClassLocation()

getClassLocation()