class JanrainCaptureSettingsForm in Janrain Registration 8
Janrain Capture settings form.
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, LinkGeneratorTrait, RedirectDestinationTrait, UrlGeneratorTrait, StringTranslationTrait
- class \Drupal\Core\Form\ConfigFormBase uses ConfigFormBaseTrait
- class \Drupal\janrain_capture\Form\JanrainCaptureSettingsForm
- class \Drupal\Core\Form\ConfigFormBase uses ConfigFormBaseTrait
Expanded class hierarchy of JanrainCaptureSettingsForm
1 string reference to 'JanrainCaptureSettingsForm'
File
- src/
Form/ JanrainCaptureSettingsForm.php, line 11
Namespace
Drupal\janrain_capture\FormView source
class JanrainCaptureSettingsForm extends ConfigFormBase {
/**
* The list of identity providers for social login.
*/
protected const SOCIAL_IDENTITY_PROVIDERS = [
'amazon' => 'Amazon',
'aol' => 'AOL',
'blogger' => 'Blogger',
'disqus' => 'Disqus',
'doccheck' => 'DocCheck',
'doximity' => 'Doximity',
'facebook' => 'Facebook',
'flickr' => 'Flickr',
'fimnet' => 'Fimnet',
'foursquare' => 'Foursquare',
'googleplus' => 'Google+',
'instagram' => 'Instagram',
'linkedin' => 'LinkedIn',
'livejournal' => 'LiveJournal',
'medikey' => 'MediKey',
'medy' => 'Medy',
'microsoftaccount' => 'Microsoft Account',
'mixi' => 'Mixi',
'mydigipass' => 'MYDIGIPASS.COM',
'odnoklassniki' => 'Odnoklassniki',
'onekey' => 'OneKey',
'openid' => 'OpenID',
'paypal' => 'PayPal',
'qq' => 'QQ',
'renren' => 'Renren',
'salesforce' => 'Salesforce',
'sina weibo' => 'Sina Weibo',
'soundcloud' => 'SoundCloud',
'tumblr' => 'Tumblr',
'twitter' => 'Twitter',
'vk' => 'VK',
'wechat' => 'WeChat',
'xing' => 'Xing',
'yahoo' => 'Yahoo!',
];
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return [
'janrain_capture.settings',
];
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'janrain_capture.settings.capture';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$config = $this
->config('janrain_capture.settings');
$form['capture'] = [
'#type' => 'fieldset',
'#tree' => TRUE,
'#title' => $this
->t('Janrain Capture settings'),
];
$form['capture']['app_id'] = [
'#type' => 'textfield',
'#title' => $this
->t('Application ID'),
'#description' => $this
->t('The Capture application ID that represents a specific capture app.'),
'#default_value' => $config
->get('capture.app_id'),
];
$form['capture']['client_id'] = [
'#type' => 'textfield',
'#title' => $this
->t('Client ID'),
'#description' => $this
->t('A client ID from your Registration application.'),
'#default_value' => $config
->get('capture.client_id'),
];
$form['capture']['client_secret'] = [
'#type' => 'textfield',
'#title' => $this
->t('Client Secret'),
'#description' => $this
->t('A client secret from your Registration application'),
'#default_value' => $config
->get('capture.client_secret'),
];
$form['capture']['load_js_url'] = [
'#type' => 'textfield',
'#title' => $this
->t('Load.js file URL'),
'#description' => $this
->t('Application load file (load.js)'),
'#default_value' => $config
->get('capture.load_js_url'),
];
$form['capture']['capture_server'] = [
'#type' => 'textfield',
'#title' => $this
->t('Capture server URL'),
'#description' => $this
->t('The URL of the server hosting the Registration application.For example, https://myapp.janraincapture.com.'),
'#default_value' => $config
->get('capture.capture_server'),
];
$form['capture']['providers'] = [
'#type' => 'details',
'#open' => FALSE,
'#title' => $this
->t('Social login'),
'#collapsible' => TRUE,
'#description' => $this
->t('Social login enables users to register on your web site by using an account created with a third-party identity provider (IDP). Read more in the <a href="@documentation">official documentation</a>.', [
'@documentation' => 'https://docs.janrain.com/social/identity-providers',
]),
];
$form['capture']['providers']['list'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Identity providers'),
'#options' => static::SOCIAL_IDENTITY_PROVIDERS,
'#default_value' => $config
->get('capture.providers'),
];
$form['capture']['engage'] = [
'#type' => 'details',
'#open' => FALSE,
'#title' => $this
->t('Engage Settings (optional)'),
'#collapsible' => TRUE,
];
$form['capture']['engage']['app_url'] = [
'#type' => 'textfield',
'#title' => $this
->t('Engage App URL'),
'#description' => $this
->t('The URL of the Janrain Engage Single Sign-on server. For example, myapp.rpxnow.com.'),
'#default_value' => $config
->get('capture.app_url'),
];
$form['capture']['engage']['token_action'] = [
'#type' => 'textfield',
'#title' => $this
->t('Engage Token Action'),
'#description' => $this
->t('The Token Action of the Janrain Engage Single Sign-on server. For example, "event".'),
'#default_value' => $config
->get('capture.token_action'),
];
$form['capture']['federate'] = [
'#type' => 'details',
'#title' => $this
->t('Federate Settings (optional)'),
'#collapsible' => TRUE,
'#open' => $config
->get('capture.enable_sso'),
];
$form['capture']['federate']['enable_sso'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable SSO'),
'#description' => $this
->t('Enable Single Sign On.'),
'#default_value' => $config
->get('capture.enable_sso'),
];
$form['capture']['federate']['federate_server'] = [
'#type' => 'textfield',
'#title' => $this
->t('Federate Server'),
'#description' => $this
->t('The URL of the Janrain Single Sign-on server. For example, myapp.janrainsso.com.'),
'#default_value' => $config
->get('capture.federate_server'),
];
$form['capture']['federate']['federate_segment'] = [
'#type' => 'textfield',
'#title' => $this
->t('Federate segment'),
'#description' => $this
->t('Specifies which SSO segment the current property belongs in.'),
'#default_value' => $config
->get('capture.federate_segment'),
];
$form['capture']['federate']['federate_supported_segments'] = [
'#type' => 'textarea',
'#title' => $this
->t('SSO Supported Segment Names'),
'#default_value' => $config
->get('capture.federate_supported_segments'),
'#description' => $this
->t('Segments that the current site is allowed to federate with using Single Sign-on.'),
];
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$capture = $form_state
->getValue('capture');
$this->configFactory
->getEditable('janrain_capture.settings')
->set('capture.app_id', $capture['app_id'])
->set('capture.client_id', $capture['client_id'])
->set('capture.client_secret', $capture['client_secret'])
->set('capture.load_js_url', $capture['load_js_url'])
->set('capture.providers', array_keys(array_filter($capture['providers']['list'])))
->set('capture.capture_server', $capture['capture_server'])
->set('capture.app_url', $capture['engage']['app_url'])
->set('capture.token_action', $capture['engage']['token_action'])
->set('capture.enable_sso', $capture['federate']['enable_sso'])
->set('capture.federate_server', $capture['federate']['federate_server'])
->set('capture.federate_segment', $capture['federate']['federate_segment'])
->set('capture.federate_supported_segments', $capture['federate']['federate_supported_segments'])
->save();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigFormBase:: |
public static | function |
Instantiates a new instance of this class. Overrides FormBase:: |
13 |
ConfigFormBase:: |
public | function | Constructs a \Drupal\system\ConfigFormBase object. | 11 |
ConfigFormBaseTrait:: |
protected | function | Retrieves a configuration object. | |
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 | Gets the config factory for this form. | 1 |
FormBase:: |
private | function | Returns the service container. | |
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. | |
FormBase:: |
public | function |
Form validation handler. Overrides FormInterface:: |
62 |
JanrainCaptureSettingsForm:: |
public | function |
Form constructor. Overrides ConfigFormBase:: |
|
JanrainCaptureSettingsForm:: |
protected | function |
Gets the configuration names that will be editable. Overrides ConfigFormBaseTrait:: |
|
JanrainCaptureSettingsForm:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
JanrainCaptureSettingsForm:: |
protected | constant | The list of identity providers for social login. | |
JanrainCaptureSettingsForm:: |
public | function |
Form submission handler. Overrides ConfigFormBase:: |
|
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. |