forked from hechoendrupal/drupal-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfirmationTrait.php
More file actions
34 lines (31 loc) · 1014 Bytes
/
Copy pathConfirmationTrait.php
File metadata and controls
34 lines (31 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* @file
* Contains Drupal\AppConsole\Command\Helper\Confirmation.
*/
namespace Drupal\AppConsole\Command\Helper;
use Symfony\Component\Console\Helper\HelperInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
trait ConfirmationTrait
{
/**
* @param InputInterface $input
* @param OutputInterface $output
* @param HelperInterface $dialog
* @return mixed
*/
public function confirmationQuestion(InputInterface $input, OutputInterface $output, HelperInterface $dialog)
{
if ($input->isInteractive()) {
if (!$dialog->askConfirmation($output,
$dialog->getQuestion($this->trans('commands.common.questions.confirm'), 'yes', '?'), true)
) {
$output->writeln('<error>' . $this->trans('commands.common.messages.canceled') . '</error>');
return true;
}
return false;
}
return false;
}
}