function SettingsForm::buildForm

Overrides ConfigFormBase::buildForm

File

tests/modules/rules_test_ui_embed/src/Form/SettingsForm.php, line 51

Class

SettingsForm
Implements the settings form.

Namespace

Drupal\rules_test_ui_embed\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, RulesUiConfigHandler $rules_ui_handler = NULL) {
    $form = parent::buildForm($form, $form_state);
    $this->rulesUiHandler = $rules_ui_handler;
    $config = $this->config('rules_test_ui_embed.settings');
    $form['css_file'] = [
        '#type' => 'textfield',
        '#title' => $this->t('CSS file'),
        '#default_value' => $config->get('css.0.file'),
        '#required' => TRUE,
    ];
    $form['conditions'] = $this->rulesUiHandler
        ->getForm()
        ->buildForm([], $form_state);
    $form['actions']['cancel'] = [
        '#type' => 'submit',
        '#limit_validation_errors' => [
            [
                'locked',
            ],
        ],
        '#value' => $this->t('Cancel'),
        '#submit' => [
            '::cancel',
        ],
    ];
    return $form;
}