File
-
src/
Form/ SettingsForm.php, line 50
Class
- SettingsForm
- Defines a form that configures Subpathauto.
Namespace
Drupal\subpathauto\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('subpathauto.settings');
$form['depth'] = [
'#type' => 'select',
'#title' => $this->t('Maximum depth of sub-paths to alias'),
'#options' => array_merge([
0 => $this->t('Disabled'),
], range(1, MenuTreeStorage::MAX_DEPTH - 1)),
'#default_value' => $config->get('depth'),
'#description' => $this->t('Increasing this value may decrease performance.'),
];
$is_redirect_installed = $this->moduleHandler
->moduleExists('redirect');
$form['redirect_support'] = [
'#type' => 'checkbox',
'#title' => $this->t('Support for redirects'),
'#default_value' => $is_redirect_installed ? $config->get('redirect_support') : FALSE,
'#disabled' => !$is_redirect_installed,
'#description' => $is_redirect_installed ? $this->t('If checked, redirects will be taken into account when resolving sub aliases.') : $this->t('If checked, redirects will be taken into account when resolving sub aliases. The redirect module should be installed for this setting.'),
];
return parent::buildForm($form, $form_state);
}