You are here

public function DomainAccessSettingsForm::buildForm in Domain Access 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

domain_access/src/Form/DomainAccessSettingsForm.php, line 32

Class

DomainAccessSettingsForm
Class DomainAccessSettingsForm.

Namespace

Drupal\domain_access\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('domain_access.settings');
  $form['node_advanced_tab'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Move Domain Access fields to advanced node settings.'),
    '#default_value' => $config
      ->get('node_advanced_tab'),
    '#description' => $this
      ->t('When checked the Domain Access fields will be shown as a tab in the advanced settings on node edit form. However, if you have placed the fields in a field group already, they will not be moved.'),
  ];
  $form['node_advanced_tab_open'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Open the Domain Access details.'),
    '#description' => $this
      ->t('Set the details tab to be open by default.'),
    '#default_value' => $config
      ->get('node_advanced_tab_open'),
    '#states' => [
      'visible' => [
        ':input[name="node_advanced_tab"]' => [
          'checked' => TRUE,
        ],
      ],
    ],
  ];
  return parent::buildForm($form, $form_state);
}