Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / system / src / Form / DateFormatDeleteForm.php
1 <?php
2
3 namespace Drupal\system\Form;
4
5 use Drupal\Core\Datetime\DateFormatterInterface;
6 use Drupal\Core\Entity\EntityDeleteForm;
7 use Symfony\Component\DependencyInjection\ContainerInterface;
8
9 /**
10  * Builds a form to delete a date format.
11  *
12  * @internal
13  */
14 class DateFormatDeleteForm extends EntityDeleteForm {
15
16   /**
17    * The date formatter service.
18    *
19    * @var \Drupal\Core\Datetime\DateFormatterInterface
20    */
21   protected $dateFormatter;
22
23   /**
24    * Constructs an DateFormatDeleteForm object.
25    *
26    * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
27    *   The date formatter service.
28    */
29   public function __construct(DateFormatterInterface $date_formatter) {
30     $this->dateFormatter = $date_formatter;
31   }
32
33   /**
34    * {@inheritdoc}
35    */
36   public static function create(ContainerInterface $container) {
37     return new static(
38       $container->get('date.formatter')
39     );
40   }
41
42   /**
43    * {@inheritdoc}
44    */
45   public function getQuestion() {
46     return t('Are you sure you want to delete the format %name : %format?', [
47       '%name' => $this->entity->label(),
48       '%format' => $this->dateFormatter->format(REQUEST_TIME, $this->entity->id()),
49     ]);
50   }
51
52 }