Updated to Drupal 8.6.4, which is PHP 7.3 friendly. Also updated HTMLaw library....
[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  * @internal
11  */
12 class DateFormatEditForm extends DateFormatFormBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public function form(array $form, FormStateInterface $form_state) {
18     $form = parent::form($form, $form_state);
19
20     $now = t('Displayed as %date', ['%date' => $this->dateFormatter->format(REQUEST_TIME, $this->entity->id())]);
21     $form['date_format_pattern']['#field_suffix'] = ' <small data-drupal-date-formatter="preview">' . $now . '</small>';
22     $form['date_format_pattern']['#default_value'] = $this->entity->getPattern();
23
24     return $form;
25   }
26
27   /**
28    * {@inheritdoc}
29    */
30   protected function actions(array $form, FormStateInterface $form_state) {
31     $actions = parent::actions($form, $form_state);
32     $actions['submit']['#value'] = t('Save format');
33     unset($actions['delete']);
34     return $actions;
35   }
36
37 }