public function DropdownLanguageSettings::buildForm in Dropdown Language 8.3
Same name and namespace in other branches
- 8 src/Form/DropdownLanguageSettings.php \Drupal\dropdown_language\Form\DropdownLanguageSettings::buildForm()
- 8.2 src/Form/DropdownLanguageSettings.php \Drupal\dropdown_language\Form\DropdownLanguageSettings::buildForm()
- 3.0.x src/Form/DropdownLanguageSettings.php \Drupal\dropdown_language\Form\DropdownLanguageSettings::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ DropdownLanguageSettings.php, line 32
Class
- DropdownLanguageSettings
- Provides a configuration form for global settings.
Namespace
Drupal\dropdown_language\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('dropdown_language.setting');
$form['labels'] = [
'#type' => 'details',
'#title' => $this
->t('Display Language Labelling'),
'#open' => TRUE,
];
$form['labels']['display_language_id'] = [
'#type' => 'radios',
'#options' => [
'0' => $this
->t('Language Name'),
'1' => $this
->t('Language ID'),
'2' => $this
->t('Native Name'),
'3' => $this
->t('Custom Labels'),
],
'#title' => $this
->t('Select which label option type'),
'#title_display' => 'invisible',
'#default_value' => $config
->get('display_language_id'),
];
$form['labels']['display_language_id'][2]['#description'] = $this
->t('Langauge Name used as title attribute');
$form['labels']['display_language_id'][3]['#description'] = $this
->t('Each block instance will provide fields for label names.');
$form['decor'] = [
'#type' => 'details',
'#title' => $this
->t('<q>@switch</q> Decor', [
'@switch' => $this
->t('Switch Language'),
]),
'#open' => TRUE,
];
$form['decor']['wrapper'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Show block with fieldset wrapping'),
'#default_value' => $config
->get('wrapper'),
];
$form['seo'] = [
'#type' => 'details',
'#title' => $this
->t('Filter Untranslated'),
'#open' => TRUE,
'#description' => $this
->t('Enhances SEO by not adding links that do not actually exist. Works with Entity based objects.'),
];
$form['seo']['filter_untranslated'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Remove links if no translation is detected.'),
'#default_value' => $config
->get('filter_untranslated'),
];
$form['seo']['always_show_block'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Keep block visible if only one language is available'),
'#default_value' => $config
->get('always_show_block'),
'#description' => $this
->t('Placed blocks will not output anything if there is not other translation available. User role access to translation is checked.'),
];
return parent::buildForm($form, $form_state);
}