\Dewdrop\Admin\Component\Stock\UsersEdit

User edit page

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
init()
setSaveButtonPosition()
getRowEditor()
process()
assignDefaultViewArguments()
render()
renderAjaxResponse()
renderAjaxForm()
getData()
renderView()
__construct()
createStockPage()
shouldProcess()
url()
createResponseHelper()
getView()
setName()
getName()
No public properties found
SAVE_BUTTON_TOP
SAVE_BUTTON_BOTTOM
SAVE_BUTTON_BOTH
getModel()
getFields()
checkPermissions()
logActivity()
redirect()
inflectViewScriptName()
$component
$rowEditor
$invalidSubmission
$isNew
$model
$fields
$saveButtonPosition
$view
$request
$viewScriptPath
N/A
stockSubclassHasViewScript()
getClassLocation()
$classLocation
$name
N/A

Constants

SAVE_BUTTON_TOP

SAVE_BUTTON_TOP

Display the save button at the top of the page.

SAVE_BUTTON_BOTTOM

SAVE_BUTTON_BOTTOM

Display the save button at the bottom of the page.

SAVE_BUTTON_BOTH

SAVE_BUTTON_BOTH

Display save button in both top and bottom positions.

Properties

$rowEditor

$rowEditor : \Dewdrop\Fields\RowEditor

The row editor we'll use to actually perform the validation and editing.

Type

\Dewdrop\Fields\RowEditor

$invalidSubmission

$invalidSubmission : boolean

Was an invalid submission made on this request?

Type

boolean

$isNew

$isNew : boolean

Is the record that we're editing new or an existing record being edited?

Type

boolean

$model

$model : \Dewdrop\Db\Table

The primary model from the CRUD component.

Type

\Dewdrop\Db\Table

$fields

$fields : \Dewdrop\Fields

The fields used when rendering the edit form.

Type

\Dewdrop\Fields

$saveButtonPosition

$saveButtonPosition : integer

Where to display the save button.

Type

integer

$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

init()

init() : void

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

setSaveButtonPosition()

setSaveButtonPosition(integer  $saveButtonPosition) : $this

Set the save button position. You can use the SAVE_BUTTON_BOTTOM, SAVE_BUTTON_TOP and SAVE_BUTTON_BOTH class constants with this method.

Parameters

integer $saveButtonPosition

Returns

$this

process()

process(\Dewdrop\Admin\ResponseHelper\Standard  $responseHelper) : void

Handle submission of the edit form. This primarily exists (rather than using the stock Edit->process()) for the password hashing.

Parameters

\Dewdrop\Admin\ResponseHelper\Standard $responseHelper

assignDefaultViewArguments()

assignDefaultViewArguments() 

render()

render() : void

Assign variables to your page's view and render the output.

renderAjaxResponse()

renderAjaxResponse() 

renderAjaxForm()

renderAjaxForm() 

getData()

getData() 

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

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

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

getModel()

getModel() 

getFields()

getFields() 

checkPermissions()

checkPermissions() : void

Check permissions

logActivity()

logActivity() 

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