You are here

public function SettingsForm::buildForm in BigBlueButton 8

Same name in this branch
  1. 8 src/Form/SettingsForm.php \Drupal\bbb\Form\SettingsForm::buildForm()
  2. 8 modules/bbb_node/src/Form/SettingsForm.php \Drupal\bbb_node\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 33

Class

SettingsForm
Provides an administration settings form.

Namespace

Drupal\bbb\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  // Get all settings.
  $config = $this->configFactory
    ->get('bbb.settings');
  $settings = $config
    ->get();
  $form['bbb_server'] = [
    '#title' => 'Server settings',
    '#type' => 'fieldset',
    '#tree' => TRUE,
    '#description' => $this
      ->t('Run <em>bbb-conf --secret</em> at the server to get correct values. Read more about BigBlueButton on <a href="@home">@home_title</a>. See the documentation for <a href="@documentation">@documentation_title</a>', [
      '@home' => 'http://bigbluebutton.org/',
      '@home_title' => $this
        ->t('BigBlueButton.org'),
      '@documentation' => 'http://code.google.com/p/bigbluebutton/',
      '@documentation_title' => $this
        ->t('installation instructions'),
    ]),
    '#attributes' => [
      'id' => 'modal-command-area',
    ],
  ];
  $form['bbb_server']['base_url'] = [
    '#title' => $this
      ->t('Base URL'),
    '#type' => 'textfield',
    '#default_value' => $settings['base_url'],
  ];
  $form['bbb_server']['security_salt'] = [
    '#title' => $this
      ->t('Security Salt'),
    '#type' => 'textfield',
    '#default_value' => $settings['security_salt'],
    '#description' => $this
      ->t('The predefined security salt. This is a server side configuration option. Please check the BigBlueButton <a href="@documentation">@documentation_title</a>.', [
      '@documentation' => 'http://code.google.com/p/bigbluebutton/',
      '@documentation_title' => $this
        ->t('installation instructions'),
    ]),
  ];
  $form['actions']['connection'] = [
    '#type' => 'button',
    '#executes_submit_callback' => FALSE,
    '#value' => $this
      ->t('Test Connection'),
    '#attributes' => [
      'class' => [
        'use-ajax',
      ],
    ],
    '#ajax' => [
      'callback' => '::testConnection',
      'wrapper' => 'modal-command-area',
    ],
    '#attached' => [
      'library' => [
        'core/drupal.dialog.ajax',
      ],
    ],
    '#weight' => 30,
  ];
  return parent::buildForm($form, $form_state);
}