DateFormatDeleteForm.php

Same filename in other branches
  1. 9 core/modules/system/src/Form/DateFormatDeleteForm.php
  2. 8.9.x core/modules/system/src/Form/DateFormatDeleteForm.php
  3. 10 core/modules/system/src/Form/DateFormatDeleteForm.php

Namespace

Drupal\system\Form

File

core/modules/system/src/Form/DateFormatDeleteForm.php

View source
<?php

namespace Drupal\system\Form;

use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Entity\EntityDeleteForm;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Builds a form to delete a date format.
 *
 * @internal
 */
class DateFormatDeleteForm extends EntityDeleteForm {
    
    /**
     * Constructs a DateFormatDeleteForm object.
     */
    public function __construct(DateFormatterInterface $dateFormatter, TimeInterface $time) {
    }
    
    /**
     * {@inheritdoc}
     */
    public static function create(ContainerInterface $container) {
        return new static($container->get('date.formatter'), $container->get('datetime.time'));
    }
    
    /**
     * {@inheritdoc}
     */
    public function getQuestion() {
        return $this->t('Are you sure you want to delete the format %name : %format?', [
            '%name' => $this->entity
                ->label(),
            '%format' => $this->dateFormatter
                ->format($this->time
                ->getRequestTime(), $this->entity
                ->id()),
        ]);
    }

}

Classes

Title Deprecated Summary
DateFormatDeleteForm Builds a form to delete a date format.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.