Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / system / src / Form / DateFormatEditForm.php
1 <?php
2
3 namespace Drupal\system\Form;
4
5 use Drupal\Core\Form\FormStateInterface;
6
7 /**
8  * Provides a form for editing a date format.
9  */
10 class DateFormatEditForm extends DateFormatFormBase {
11
12   /**
13    * {@inheritdoc}
14    */
15   public function form(array $form, FormStateInterface $form_state) {
16     $form = parent::form($form, $form_state);
17
18     $now = t('Displayed as %date', ['%date' => $this->dateFormatter->format(REQUEST_TIME, $this->entity->id())]);
19     $form['date_format_pattern']['#field_suffix'] = ' <small data-drupal-date-formatter="preview">' . $now . '</small>';
20     $form['date_format_pattern']['#default_value'] = $this->entity->getPattern();
21
22     return $form;
23   }
24
25   /**
26    * {@inheritdoc}
27    */
28   protected function actions(array $form, FormStateInterface $form_state) {
29     $actions = parent::actions($form, $form_state);
30     $actions['submit']['#value'] = t('Save format');
31     unset($actions['delete']);
32     return $actions;
33   }
34
35 }