Class ViewTask
Task class for creating and updating view files.
- AppShell
- BakeTask
- ViewTask
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Console/Command/Task/ViewTask.php
Properties summary
-
$controllerName
publicstring
Name of the controller being used -
$noTemplateActions
publicarray
An array of action names that don't require templates. These actions will not emit errors when doing bakeActions()
-
$path
publicarray
path to View directory -
$scaffoldActions
publicarray
Actions to use for scaffolding -
$tasks
publicarray
Tasks to be loaded by this Task -
$template
publicstring
The template file to use
Inherited Properties
Method Summary
-
_associations() protected
Returns associations for controllers models. -
_interactive() protected
Handles interactive baking -
_loadController() protected
Loads Controller and sets variables for the template Available template variables 'modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar', 'singularHumanName', 'pluralHumanName', 'fields', 'foreignKeys', 'belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany'
-
_methodsToBake() protected
Get a list of actions that can / should have views baked for them. -
all() public
Bake All views for All controllers. -
bake() public
Assembles and writes bakes the view file. -
bakeActions() public
Bake a view file for each of the supplied actions -
customAction() public
handle creation of baking a custom action view file -
execute() public
Execution method always used for tasks -
getContent() public
Builds content from template and variables -
getOptionParser() public
Gets the option parser instance and configures it. -
getTemplate() public
Gets the template name based on the action name -
initialize() public
Override initialize
Method Detail
_associations() protected ¶
_associations( Model
$model )
Returns associations for controllers models.
Parameters
-
Model
$model - The Model instance.
Returns
associations
_loadController() protected ¶
_loadController( )
Loads Controller and sets variables for the template Available template variables 'modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar', 'singularHumanName', 'pluralHumanName', 'fields', 'foreignKeys', 'belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany'
Returns
Returns a variables to be made available to a view template
_methodsToBake() protected ¶
_methodsToBake( )
Get a list of actions that can / should have views baked for them.
Returns
Array of action names that should be baked
bake() public ¶
bake( string $action , string $content = '' )
Assembles and writes bakes the view file.
Parameters
- string $action
- Action to bake
- string $content optional ''
- Content to write
Returns
Success
bakeActions() public ¶
bakeActions( array $actions , array $vars )
Bake a view file for each of the supplied actions
Parameters
- array $actions
- Array of actions to make files for.
- array $vars
- The template variables.
getContent() public ¶
getContent( string $action , array $vars = null )
Builds content from template and variables
Parameters
- string $action
- name to generate content to
- array $vars optional null
- passed for use in templates
Returns
content from template
getTemplate() public ¶
getTemplate( string $action )
Gets the template name based on the action name
Parameters
- string $action
- name
Returns
template name
Methods inherited from BakeTask
Properties detail
$noTemplateActions ¶
An array of action names that don't require templates. These actions will not emit errors when doing bakeActions()
array('delete')
$scaffoldActions ¶
Actions to use for scaffolding
array('index', 'view', 'add', 'edit')