mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Only add Flash component when required
If a user selected no to the question "Would you like to use Session flash messages?" it would still use the Flash component, but not use it
This commit is contained in:
parent
61c0415734
commit
31cddbe48a
1 changed files with 4 additions and 4 deletions
|
@ -182,11 +182,11 @@ class ControllerTask extends BakeTask {
|
|||
$components = $this->doComponents();
|
||||
|
||||
$wannaUseSession = $this->in(
|
||||
__d('cake_console', "Would you like to use Session flash messages?"), array('y', 'n'), 'y'
|
||||
__d('cake_console', "Would you like to use the FlashComponent to display flash messages?"), array('y', 'n'), 'y'
|
||||
);
|
||||
|
||||
if (strtolower($wannaUseSession) === 'y') {
|
||||
array_push($components, 'Session');
|
||||
array_push($components, 'Session', 'Flash');
|
||||
}
|
||||
array_unique($components);
|
||||
}
|
||||
|
@ -384,9 +384,9 @@ class ControllerTask extends BakeTask {
|
|||
* @return array Components the user wants to use.
|
||||
*/
|
||||
public function doComponents() {
|
||||
$components = array('Paginator', 'Flash');
|
||||
$components = array('Paginator');
|
||||
return array_merge($components, $this->_doPropertyChoices(
|
||||
__d('cake_console', "Would you like this controller to use other components\nbesides PaginatorComponent and FlashComponent?"),
|
||||
__d('cake_console', "Would you like this controller to use other components\nbesides PaginatorComponent?"),
|
||||
__d('cake_console', "Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'")
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue