On this page
Class ViewTask
Task class for creating and updating view files.
- AppShell
BakeTask
ViewTask
Copyright: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
License: MIT License
Location: Cake/Console/Command/Task/ViewTask.php
Properties summary
-
$controllerName
publicstring
-
$noTemplateActions
publicarray
An array of action names that don't require templates. These actions will not emit errors when doing bakeActions()
-
$path
publicarray
-
$scaffoldActions
publicarray
-
$tasks
publicarray
-
$template
publicstring
Inherited Properties
Method Summary
-
_associations() protectedReturns associations for controllers models.
-
_interactive() protectedHandles 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() protectedGet a list of actions that can / should have views baked for them.
-
all() publicBake All views for All controllers.
-
bake() publicAssembles and writes bakes the view file.
-
bakeActions() publicBake a view file for each of the supplied actions
-
customAction() publichandle creation of baking a custom action view file
-
execute() publicExecution method always used for tasks
-
getContent() publicBuilds content from template and variables
-
getOptionParser() publicGets the option parser instance and configures it.
-
getTemplate() publicGets the template name based on the action name
-
initialize() publicOverride initialize
Method Detail
_associations()source protected
_associations( Model $model )
Returns associations for controllers models.
Parameters
Model
$model
- The Model instance.
Returns
arrayassociations
_loadController()source 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
arrayReturns a variables to be made available to a view template
_methodsToBake()source protected
_methodsToBake( )
Get a list of actions that can / should have views baked for them.
Returns
arrayArray of action names that should be baked
bake()source 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
booleanSuccess
bakeActions()source 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.
execute()source public
execute( )
Execution method always used for tasks
Returns
mixedOverrides
BakeTask::execute()
getContent()source 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
stringcontent from template
getOptionParser()source public
getOptionParser( )
Gets the option parser instance and configures it.
Returns
ConsoleOptionParser
getTemplate()source public
getTemplate( string $action )
Gets the template name based on the action name
Parameters
-
string
$action
- name
Returns
stringtemplate name
Methods inherited from BakeTask
getPath()source public
getPath( )
Gets the path for output. Checks the plugin property and returns the correct path.
Returns
stringPath to output.
startup()source public
startup( )
Disable caching and enable debug for baking. This forces the most current database schema to be used.
Properties detail
$noTemplateActionssource
public array
An array of action names that don't require templates. These actions will not emit errors when doing bakeActions()
array('delete')
$scaffoldActionssource
public array
Actions to use for scaffolding
array('index', 'view', 'add', 'edit')
$taskssource
public array
Tasks to be loaded by this Task
array('Project', 'Controller', 'DbConfig', 'Template')
© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/2.10/class-ViewTask.html