DateFormatEditForm.php in Drupal 10
File
core/modules/system/src/Form/DateFormatEditForm.php
View source
<?php
namespace Drupal\system\Form;
use Drupal\Core\Form\FormStateInterface;
class DateFormatEditForm extends DateFormatFormBase {
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$now = $this
->t('Displayed as %date', [
'%date' => $this->dateFormatter
->format(REQUEST_TIME, $this->entity
->id()),
]);
$form['date_format_pattern']['#field_suffix'] = ' <small data-drupal-date-formatter="preview">' . $now . '</small>';
$form['date_format_pattern']['#default_value'] = $this->entity
->getPattern();
return $form;
}
protected function actions(array $form, FormStateInterface $form_state) {
$actions = parent::actions($form, $form_state);
$actions['submit']['#value'] = $this
->t('Save format');
unset($actions['delete']);
return $actions;
}
}