You are here

public function LtiToolProviderSettingsForm::buildForm in LTI Tool Provider 2.x

Same name and namespace in other branches
  1. 8 src/Form/LtiToolProviderSettingsForm.php \Drupal\lti_tool_provider\Form\LtiToolProviderSettingsForm::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/LtiToolProviderSettingsForm.php, line 20

Class

LtiToolProviderSettingsForm

Namespace

Drupal\lti_tool_provider\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) : array {
  $settings = $this
    ->config('lti_tool_provider.settings');
  $form['iframe'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Allow iframe embeds'),
    '#default_value' => $settings
      ->get('iframe'),
    '#description' => $this
      ->t('Allow LTI content to be displayed in an iframe. This will disable Drupal\'s built in x-frame-options header. See <a href="https://www.drupal.org/node/2514152">this change record</a> for more details.'),
  ];
  $form['destination'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Destination to redirect to after launch and successful authentication.'),
    '#default_value' => $settings
      ->get('destination'),
    '#description' => $this
      ->t('Enter an internal site url, including the base path, e.g. "/front". After an LTI authentication is successful, redirect the user to this url. Note that if there is a custom destination specified in the LTI request, it will override this setting.'),
  ];
  return parent::buildForm($form, $form_state);
}