Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $form['#tree'] = TRUE;
- $form['clients_enabled'] = array(
- '#title' => t('Enable PixelPin OpenID Connect'),
- '#type' => 'checkboxes',
- '#options' => array('pixelpin' => $this->t('Enable')),
- '#default_value' => $clients_enabled,
- );
- public function buildForm(array $form, FormStateInterface $form_state) {
- $definitions = $this->pluginManager->getDefinitions();
- foreach ($definitions as $client_id => $client) {
- foreach ($this->pluginManager->getDefinitions() as $client_name => $client_plugin) {
- if (!$this->config('pixelpin_openid_connect.settings.' . $client_id)
- ->get('enabled')) {
- $url = Drupal::service('path.current')->getPath();
- $find = 'login';
- $pos = strpos($url, $find);
- if ($pos === false){
- $value = 'Register Using @client_title';
- } else {
- $value = 'Log in with @client_title';
- }
- $element = 'clients_enabled[' . $client_plugin['id'] . ']';
- $form['pixelpin_openid_connect_client_' . $client_id . '_login'] = array(
- '#type' => 'submit',
- '#value' => t($value, array(
- '@client_title' => $client['label'],
- )),
- 'visible' => array(
- ':input[name="' . $element . '"]' => array('checked' => TRUE),
- ),
- '#name' => $client_id,
- '#prefix' => '<div>',
- '#suffix' => '</div>',
- );
- }
- }
- }
- return $form;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement