public function UIkitComponentsAdminForm::buildForm in UIkit Components 8
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/ UIkitComponentsAdminForm.php, line 21
Class
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();
if ($uikit_version) {
$config
->set('uikit_components.uikit_framework_version', $uikit_version);
}
else {
$config
->set('uikit_components.uikit_framework_version', $this
->t('The UIkit base theme is not installed.'));
}
// UIkit framework version field.
$form['uikit_framework_version'] = [
'#type' => 'item',
'#title' => $this
->t('UIkit Framework Version'),
'#markup' => $config
->get('uikit_components.uikit_framework_version'),
];
return $form;
}