class DateFormatEditForm
Same name and namespace in other branches
- 11.x core/modules/system/src/Form/DateFormatEditForm.php \Drupal\system\Form\DateFormatEditForm
Provides a form for editing a date format.
@internal
Hierarchy
- class \Drupal\Core\Form\FormBase extends \Drupal\Core\Form\FormInterface, \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\Core\Entity\EntityForm extends \Drupal\Core\Entity\EntityFormInterface implements \Drupal\Core\Form\FormBase
- class \Drupal\system\Form\DateFormatFormBase implements \Drupal\Core\Entity\EntityForm
- class \Drupal\system\Form\DateFormatEditForm implements \Drupal\system\Form\DateFormatFormBase
- class \Drupal\system\Form\DateFormatFormBase implements \Drupal\Core\Entity\EntityForm
- class \Drupal\Core\Entity\EntityForm extends \Drupal\Core\Entity\EntityFormInterface implements \Drupal\Core\Form\FormBase
Expanded class hierarchy of DateFormatEditForm
File
-
core/
modules/ system/ src/ Form/ DateFormatEditForm.php, line 12
Namespace
Drupal\system\FormView source
class DateFormatEditForm extends DateFormatFormBase {
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
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;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.