\Dewdrop\Admin\Page\StockCountsExport

This page takes the selected field from the Counts page and uses it to fetch data from a Dewdrop\Fields\Listing\Counter object and export it to CSV.

The stock page controller implements a basic three step execution process:

  • init(): Create any resources shared by both process() and render()
  • process(): Perform and form processing or data manipulation. Optionally, short-circuit further execution and bypass rendering by redirecting, aborting, etc.
  • render(): Assign values to your view. You can either directly render your view script in this method (or generate output in any other way), or, if no output is generated by render(), Dewdrop will attempt to render your default view script automatically.

Sub-classes, such as EditAbstract, can be created that alter this basic page controller flow of execution. EditAbstract, for example, will only call process() if the request is a POST.

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() 

Ensure the user has permission to access the counts page on this component.

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() 

Assemble elements from the component and a Counter object and pass them along to 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()