forked from saltonmassally/Drupal-CAC-Modules
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e797538
commit 879dc57
Showing
3 changed files
with
56 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
auth_prompt: | ||
path: 'modules/auth_prompt' | ||
defaults: | ||
_title: 'Auth Promt' | ||
_title: 'Auth Prompt' | ||
requirements: | ||
_permission: 'access content' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Contains \Drupal\auth_prompt\Form\AuthPromptDispatchForm. | ||
*/ | ||
|
||
namespace Drupal\auth_prompt\Form; | ||
|
||
use Drupal\Core\Form\FormBase; | ||
use Drupal\Core\Form\FormStateInterface; | ||
use Drupal\auth_prompt\AuthPrompt; | ||
|
||
/** | ||
* Class AuthPromptDispatchForm. | ||
* | ||
* @package Drupal\auth_prompt\Form | ||
*/ | ||
class AuthPromptDispatchForm extends FormBase { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getFormId() { | ||
return 'auth_prompt_dispatch_form'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function buildForm(array $form, FormStateInterface $form_state) { | ||
$form['name'] = array( | ||
'#type' => 'textfield', | ||
'#title' => $this->t('Reference'), | ||
'#description' => $this->t('Authentication prompt to an anonymus user of the website.'), | ||
'#maxlength' => 64, | ||
'#size' => 64, | ||
); | ||
$form['dispatch'] = array( | ||
'#type' => 'submit', | ||
'#value' => $this->t('Dispatch'), | ||
); | ||
return $form; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function submitForm(array &$form, FormStateInterface $form_state) { | ||
// AuthPrompt Dispatching | ||
$dispatcher = \Drupal::service('event_dispatcher'); | ||
$event = new AuthPrompt($form_state->getValue('name')); | ||
$dispatcher->dispatch(AuthPrompt::SUBMIT, $event); | ||
} | ||
} |