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
-
$controllerNamepublicName of the controller being usedstring -
$noTemplateActionspublicarrayAn array of action names that don't require templates. These actions will not emit errors when doing bakeActions()
-
$pathpublicpath to View directoryarray -
$scaffoldActionspublicActions to use for scaffoldingarray -
$taskspublicTasks to be loaded by this Taskarray -
$templatepublicThe template file to usestring
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
$contentoptional '' - 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
$varsoptional null - passed for use in templates
Returns
stringcontent from template
getOptionParser()source public
getOptionParser( )
Gets the option parser instance and configures it.
Returns
ConsoleOptionParsergetTemplate()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–2016 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.9/class-ViewTask.html