class MenuLinksetSettingsForm
Same name and namespace in other branches
- 11.x core/modules/system/src/Form/MenuLinksetSettingsForm.php \Drupal\system\Form\MenuLinksetSettingsForm
Configure System settings for this site.
Hierarchy
- class \Drupal\system\Form\MenuLinksetSettingsForm
Expanded class hierarchy of MenuLinksetSettingsForm
File
-
core/
modules/ system/ src/ Form/ MenuLinksetSettingsForm.php, line 15
Namespace
Drupal\system\FormView source
class MenuLinksetSettingsForm extends ConfigFormBase {
/**
* Constructs a MenuLinksetSettingsForm object.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The factory for configuration objects.
* @param \Drupal\Core\Config\TypedConfigManagerInterface $typedConfigManager
* The typed config manager.
* @param \Drupal\Core\Routing\RouteBuilderInterface $routerBuilder
* The router builder service.
*/
public function __construct(ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typedConfigManager, protected readonly RouteBuilderInterface $routerBuilder) {
parent::__construct($config_factory, $typedConfigManager);
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('config.factory'), $container->get('config.typed'), $container->get('router.builder'));
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'menu_linkset_settings';
}
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return [
'system.feature_flags',
];
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['linkset']['enable_endpoint'] = [
'#type' => 'checkbox',
'#title' => $this->t('Enable the menu linkset endpoint'),
'#description' => $this->t('See the <a href="@docs-link">decoupled menus documentation</a> for more information.', [
'@docs-link' => 'https://www.drupal.org/docs/develop/decoupled-drupal/decoupled-menus',
]),
'#default_value' => $this->config('system.feature_flags')
->get('linkset_endpoint'),
];
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('system.feature_flags')
->set('linkset_endpoint', $form_state->getValue('enable_endpoint'))
->save();
parent::submitForm($form, $form_state);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
MenuLinksetSettingsForm::buildForm | public | function | Form constructor. |
MenuLinksetSettingsForm::create | public static | function | Instantiates a new instance of this class. |
MenuLinksetSettingsForm::getEditableConfigNames | protected | function | Gets the configuration names that will be editable. |
MenuLinksetSettingsForm::getFormId | public | function | Returns a unique string identifying the form. |
MenuLinksetSettingsForm::submitForm | public | function | Form submission handler. |
MenuLinksetSettingsForm::__construct | public | function | Constructs a MenuLinksetSettingsForm object. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.