Builds a form for enabling a module.
Expanded class hierarchy of DateFormatLocalizeResetForm
class DateFormatLocalizeResetForm extends ConfirmFormBase implements ControllerInterface {
/**
* The language to be reset.
*
* @var \Drupal\Core\Language\Language;
*/
protected $language;
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactory
*/
protected $configFactory;
/**
* Constructs a DateFormatLocalizeResetForm object.
*/
public function __construct(ConfigFactory $config_factory) {
$this->configFactory = $config_factory;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('config.factory'));
}
/**
* {@inheritdoc}
*/
public function getFormID() {
return 'system_date_format_localize_reset_form';
}
/**
* {@inheritdoc}
*/
protected function getQuestion() {
return t('Are you sure you want to reset the date formats for %language to the global defaults?', array(
'%language' => $this->language->name,
));
}
/**
* {@inheritdoc}
*/
protected function getConfirmText() {
return t('Reset');
}
/**
* {@inheritdoc}
*/
protected function getCancelPath() {
return 'admin/config/regional/date-time/locale';
}
/**
* {@inheritdoc}
*/
protected function getDescription() {
return t('Resetting will remove all localized date formats for this language. This action cannot be undone.');
}
/**
* {@inheritdoc}
*
* @param string $langcode
* The language code.
*
*/
public function buildForm(array $form, array &$form_state, $langcode = NULL) {
$this->language = language_load($langcode);
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, array &$form_state) {
$this->configFactory
->get('locale.config.' . $this->language->langcode . '.system.date')
->delete();
$form_state['redirect'] = 'admin/config/regional/date-time/locale';
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfirmFormBase:: |
protected | function | Returns a caption for the link which cancels the action. | 2 |
ConfirmFormBase:: |
protected | function | Returns the internal name used to refer to the confirmation item. | |
ConfirmFormBase:: |
public | function |
Implements \Drupal\Core\Form\FormInterface::validateForm(). Overrides FormInterface:: |
1 |
DateFormatLocalizeResetForm:: |
protected | property | The config factory. | |
DateFormatLocalizeResetForm:: |
protected | property | The language to be reset. | |
DateFormatLocalizeResetForm:: |
public | function |
Overrides ConfirmFormBase:: |
|
DateFormatLocalizeResetForm:: |
public static | function |
Instantiates a new instance of this controller. Overrides ControllerInterface:: |
|
DateFormatLocalizeResetForm:: |
protected | function |
Returns the page to go to if the user cancels the action. Overrides ConfirmFormBase:: |
|
DateFormatLocalizeResetForm:: |
protected | function |
Returns a caption for the button that confirms the action. Overrides ConfirmFormBase:: |
|
DateFormatLocalizeResetForm:: |
protected | function |
Returns additional text to display as a description. Overrides ConfirmFormBase:: |
|
DateFormatLocalizeResetForm:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
DateFormatLocalizeResetForm:: |
protected | function |
Returns the question to ask the user. Overrides ConfirmFormBase:: |
|
DateFormatLocalizeResetForm:: |
public | function |
Form submission handler. Overrides FormInterface:: |
|
DateFormatLocalizeResetForm:: |
public | function | Constructs a DateFormatLocalizeResetForm object. |