You are here

public function ImceSettingsForm::buildForm in IMCE 8

Same name and namespace in other branches
  1. 8.2 src/Form/ImceSettingsForm.php \Drupal\imce\Form\ImceSettingsForm::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/ImceSettingsForm.php, line 74

Class

ImceSettingsForm
Imce settings form.

Namespace

Drupal\imce\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('imce.settings');
  $form['roles_profiles'] = $this
    ->buildRolesProfilesTable($config
    ->get('roles_profiles') ?: []);

  // Common settings container.
  $form['common'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Common settings'),
  ];
  $form['common']['abs_urls'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable absolute URLs'),
    '#description' => $this
      ->t('Make the file manager return absolute file URLs to other applications.'),
    '#default_value' => $config
      ->get('abs_urls'),
  ];
  $form['common']['admin_theme'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Use admin theme for IMCE paths'),
    '#default_value' => $config
      ->get('admin_theme'),
    '#description' => $this
      ->t('If you have user interface issues with the active theme you may consider switching to admin theme.'),
  ];
  $form['#attached']['library'][] = 'imce/drupal.imce.admin';
  return parent::buildForm($form, $form_state);
}