Upgraded drupal core with security updates
[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 class DateFormatDeleteForm extends EntityDeleteForm {
13
14   /**
15    * The date formatter service.
16    *
17    * @var \Drupal\Core\Datetime\DateFormatterInterface
18    */
19   protected $dateFormatter;
20
21   /**
22    * Constructs an DateFormatDeleteForm object.
23    *
24    * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
25    *   The date formatter service.
26    */
27   public function __construct(DateFormatterInterface $date_formatter) {
28     $this->dateFormatter = $date_formatter;
29   }
30
31   /**
32    * {@inheritdoc}
33    */
34   public static function create(ContainerInterface $container) {
35     return new static(
36       $container->get('date.formatter')
37     );
38   }
39
40   /**
41    * {@inheritdoc}
42    */
43   public function getQuestion() {
44     return t('Are you sure you want to delete the format %name : %format?', [
45       '%name' => $this->entity->label(),
46       '%format' => $this->dateFormatter->format(REQUEST_TIME, $this->entity->id())]
47     );
48   }
49
50 }