You are here

public function SettingsForm::buildForm in CRM Core 8.3

Same name in this branch
  1. 8.3 src/Form/SettingsForm.php \Drupal\crm_core\Form\SettingsForm::buildForm()
  2. 8.3 modules/crm_core_user_sync/src/Form/SettingsForm.php \Drupal\crm_core_user_sync\Form\SettingsForm::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/SettingsForm.php, line 64

Class

SettingsForm
Configure general settings.

Namespace

Drupal\crm_core\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('crm_core.settings');
  $form['theme'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('CRM Theme'),
    '#weight' => 1,
  ];
  $themes = [
    '' => $this
      ->t('Default'),
  ];
  foreach ($this->themeHandler
    ->listInfo() as $theme) {
    if ($theme->status == 1) {
      $themes[$theme
        ->getName()] = $this->themeHandler
        ->getName($theme
        ->getName());
    }
  }
  $form['theme']['crm_core_custom_theme'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Use a custom theme for the CRM UI'),
    '#description' => $this
      ->t('When checked, all pages under the crm-core path will be displayed using this theme.'),
    '#default_value' => $config
      ->get('custom_theme'),
    '#options' => $themes,
    '#weight' => 0,
  ];
  return parent::buildForm($form, $form_state);
}