Class ViewTask
Task class for creating and updating view files.
- AppShell
- 
			 BakeTask BakeTask
- 
			 ViewTask ViewTask
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Console/Command/Task/ViewTask.php
Properties summary
- 
			$controllerNamepublicstringName of the controller being used
- 
			$noTemplateActionspublicarrayAn array of action names that don't require templates. These actions will not emit errors when doing bakeActions() 
- 
			$pathpublicarraypath to View directory
- 
			$scaffoldActionspublicarrayActions to use for scaffolding
- 
			$taskspublicarrayTasks to be loaded by this Task
- 
			$templatepublicstringThe template file to use
Inherited Properties
Method Summary
- 
			_associations() protectedReturns associations for controllers models.
- 
			_interactive() protectedHandles interactive baking
- 
			_loadController() protectedLoads 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() 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')
