public function AdminForm::buildForm in UIkit Components 8.3
Same name and namespace in other branches
- 8.2 src/Form/AdminForm.php \Drupal\uikit_components\Form\AdminForm::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/ AdminForm.php, line 24
Class
- AdminForm
- Form builder for the UIkit Components administration form.
Namespace
Drupal\uikit_components\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
// Form constructor.
$form = parent::buildForm($form, $form_state);
// Default settings.
$config = $this
->config('uikit_components.settings');
// Get UIkit framework version from UIkit base theme.
$uikit_version = UIkitComponents::getUIkitLibraryVersion();
// UIkit framework version field.
if ($uikit_version) {
$form['uikit_framework_version'] = [
'#type' => 'item',
'#title' => $this
->t('UIkit Framework Version'),
'#markup' => $uikit_version ? $uikit_version : $this
->t('The UIkit base theme is not installed.'),
];
$form['additional_menu_styles'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable configurable menu styles'),
'#description' => $this
->t('Enable selecting menu styles when adding and editing <a href="/admin/structure/menu">menus</a>. This provides three new menu templates: <em class="placeholder">menu--default.html.twig</em> as a default, <em class="placeholder">menu--uk-menu.html.twig</em> for uk-list and uk-subnav menus and <em class="placeholder">menu--uk-nav.html.twig</em> for uk-nav menus. This also ignores the admin toolbar and devel module menus so they can be rendered correctly.'),
'#default_value' => $config
->get('additional_menu_styles'),
];
}
return $form;
}