class BasicAdvancedForm in Auth0 Single Sign On 8
Same name and namespace in other branches
- 8.2 src/Form/BasicAdvancedForm.php \Drupal\auth0\Form\BasicAdvancedForm
This forms handles the advanced module configurations.
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, LinkGeneratorTrait, RedirectDestinationTrait, UrlGeneratorTrait, StringTranslationTrait
- class \Drupal\auth0\Form\BasicAdvancedForm
Expanded class hierarchy of BasicAdvancedForm
1 string reference to 'BasicAdvancedForm'
File
- src/
Form/ BasicAdvancedForm.php, line 15 - Contains \Drupal\auth0\Form\BasicAdvancedForm.
Namespace
Drupal\auth0\FormView source
class BasicAdvancedForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'auth0_basic_settings_form';
}
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = \Drupal::service('config.factory')
->getEditable('auth0.settings');
$config
->set('auth0_form_title', $form_state
->getValue('auth0_form_title'))
->set('auth0_allow_signup', $form_state
->getValue('auth0_allow_signup'))
->set('auth0_redirect_for_sso', $form_state
->getValue('auth0_redirect_for_sso'))
->set('auth0_widget_cdn', $form_state
->getValue('auth0_widget_cdn'))
->set('auth0_requires_verified_email', $form_state
->getValue('auth0_requires_verified_email'))
->set('auth0_login_css', $form_state
->getValue('auth0_login_css'))
->set('auth0_lock_extra_settings', $form_state
->getValue('auth0_lock_extra_settings'))
->save();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BasicAdvancedForm:: |
public | function |
Form constructor. Overrides FormInterface:: |
|
BasicAdvancedForm:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
BasicAdvancedForm:: |
public | function |
Form submission handler. Overrides FormInterface:: |
|
BasicAdvancedForm:: |
public | function |
Form validation handler. Overrides FormBase:: |
|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
FormBase:: |
protected | property | The config factory. | 1 |
FormBase:: |
protected | property | The request stack. | 1 |
FormBase:: |
protected | property | The route match. | |
FormBase:: |
protected | function | Retrieves a configuration object. | |
FormBase:: |
protected | function | Gets the config factory for this form. | 1 |
FormBase:: |
private | function | Returns the service container. | |
FormBase:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
87 |
FormBase:: |
protected | function | Gets the current user. | |
FormBase:: |
protected | function | Gets the request object. | |
FormBase:: |
protected | function | Gets the route match. | |
FormBase:: |
protected | function | Gets the logger for a specific channel. | |
FormBase:: |
protected | function |
Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait:: |
|
FormBase:: |
public | function | Resets the configuration factory. | |
FormBase:: |
public | function | Sets the config factory for this form. | |
FormBase:: |
public | function | Sets the request stack object to use. | |
LinkGeneratorTrait:: |
protected | property | The link generator. | 1 |
LinkGeneratorTrait:: |
protected | function | Returns the link generator. | |
LinkGeneratorTrait:: |
protected | function | Renders a link to a route given a route name and its parameters. | |
LinkGeneratorTrait:: |
public | function | Sets the link generator service. | |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
UrlGeneratorTrait:: |
protected | property | The url generator. | |
UrlGeneratorTrait:: |
protected | function | Returns the URL generator service. | |
UrlGeneratorTrait:: |
public | function | Sets the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Generates a URL or path for a specific route based on the given parameters. |