Do you remember the way the configuration forms work in Drupal 7? No need to create a submit method to store your variables, so if you miss this in Drupal 8 this module is for you my lazy friend.
Using the module
<?php
namespace Drupal\mymodule\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\lazy_config_form\Form\LazyConfigForm;
/**
* Class AdminSettings.
*/
class AdminSettings extends LazyConfigForm {
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return [
'admin.settings',
];
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'admin_settings';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config($this->getEditableConfigNames()[0]);
$form['personal_access_token'] = [
'#type' => 'textfield',
'#title' => $this->t('Personal Access Token'),
'#default_value' => $config->get('personal_access_token'),
];
return parent::buildForm($form, $form_state);
}
}
Issues
As with all contributed modules, when considering submitting an issue:
- Read the documentation (two or three times is better). Don't forget the home page.
- Review the existing issues list. (Don't forget to select "<- Any ->" for the "Status" field.)
- Gather all the appropriate information. This may include (but is not limited to):
- Drupal version.
- Browser type and version.
- Database type and version.
- Error messages, if any.
- Module settings.
- Submit the issue. If other modules are involved, you may need to submit the issue to those modules as well.
- If you go to provide a patch use the following naming convention:
[lazy_config_form]-[short-description]-[issue-number]-[comment-number]-[drupal-version].patch
And please don't forget to use the Issue Summary Template to report an issue, if you need help to understand how the issue queue works, see the Getting Started in the Issue Queue video.
Development version status
The development versions (-dev) are where the newest stuff is, including any bug fixes and new features. We try to make sure it is tested before we commit anything, but occasionally a bug will get from us. Your help on testing this code is greatly appreciated. The translation templates may not always be up-to-date in the dev releases.
Project information
- Project categories: Developer tools
- Created by adriancid on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.
