You are here

public function BasicAdvancedForm::buildForm in Auth0 Single Sign On 8

Same name and namespace in other branches
  1. 8.2 src/Form/BasicAdvancedForm.php \Drupal\auth0\Form\BasicAdvancedForm::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 FormInterface::buildForm

File

src/Form/BasicAdvancedForm.php, line 27
Contains \Drupal\auth0\Form\BasicAdvancedForm.

Class

BasicAdvancedForm
This forms handles the advanced module configurations.

Namespace

Drupal\auth0\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = \Drupal::service('config.factory')
    ->get('auth0.settings');
  $form['auth0_form_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Form title'),
    '#default_value' => $config
      ->get('auth0_form_title', 'Sign In'),
    '#description' => t('This is the title for the login widget.'),
  );
  $form['auth0_allow_signup'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow user signup'),
    '#default_value' => $config
      ->get('auth0_allow_signup'),
    '#description' => t('If you have database connection you can allow users to signup in the widget.'),
  );
  $form['auth0_redirect_for_sso'] = array(
    '#type' => 'checkbox',
    '#title' => t('Redirect login for SSO'),
    '#default_value' => $config
      ->get('auth0_redirect_for_sso'),
    '#description' => t('If you are supporting SSO for your customers for other apps, including this application, click this to redirect to your Auth0 Hosted Login Page for Login and Signup'),
  );
  $form['auth0_widget_cdn'] = array(
    '#type' => 'textfield',
    '#title' => t('Widget CDN'),
    '#default_value' => $config
      ->get('auth0_widget_cdn'),
    '#description' => t('Point this to the latest widget available in the CDN.'),
  );
  $form['auth0_requires_verified_email'] = array(
    '#type' => 'checkbox',
    '#title' => t('Requires verified email'),
    '#default_value' => $config
      ->get('auth0_requires_verified_email'),
    '#description' => t('Mark this if you require the user to have a verified email to login.'),
  );
  $form['auth0_login_css'] = array(
    '#type' => 'textarea',
    '#title' => t('Login widget css'),
    '#default_value' => $config
      ->get('auth0_login_css'),
    '#description' => t('This css controls how the widget look and feel.'),
  );
  $form['auth0_lock_extra_settings'] = array(
    '#type' => 'textarea',
    '#title' => t('Lock extra settings'),
    '#default_value' => $config
      ->get('auth0_lock_extra_settings'),
    '#description' => t('This should be a valid JSON file. This entire object will be passed to the lock options parameter.'),
  );
  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => $this
      ->t('Save'),
    '#button_type' => 'primary',
  );
  return $form;
}