Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 11 |
DateFormatDeleteForm | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 11 |
__construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
create | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
getQuestion | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 5 |
<?php | |
/** | |
* @file | |
* Contains \Drupal\system\Form\DateFormatDeleteForm. | |
*/ | |
namespace Drupal\system\Form; | |
use Drupal\Core\Datetime\DateFormatterInterface; | |
use Drupal\Core\Entity\EntityDeleteForm; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
/** | |
* Builds a form to delete a date format. | |
*/ | |
class DateFormatDeleteForm extends EntityDeleteForm { | |
/** | |
* The date formatter service. | |
* | |
* @var \Drupal\Core\Datetime\DateFormatterInterface | |
*/ | |
protected $dateFormatter; | |
/** | |
* Constructs an DateFormatDeleteForm object. | |
* | |
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter | |
* The date formatter service. | |
*/ | |
public function __construct(DateFormatterInterface $date_formatter) { | |
$this->dateFormatter = $date_formatter; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public static function create(ContainerInterface $container) { | |
return new static( | |
$container->get('date.formatter') | |
); | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function getQuestion() { | |
return t('Are you sure you want to delete the format %name : %format?', array( | |
'%name' => $this->entity->label(), | |
'%format' => $this->dateFormatter->format(REQUEST_TIME, $this->entity->id())) | |
); | |
} | |
} |