-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from OS2Forms/develop
Merge develop into master
- Loading branch information
Showing
4 changed files
with
116 additions
and
16 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
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,64 @@ | ||
<?php | ||
|
||
namespace Drupal\os2forms_nemid\Element; | ||
|
||
use Drupal\Core\Form\FormStateInterface; | ||
|
||
/** | ||
* Provides a 'os2forms_nemid_kommunekode'. | ||
* | ||
* @FormElement("os2forms_nemid_kommunekode") | ||
* | ||
* @see \Drupal\Core\Render\Element\FormElement | ||
* @see https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21Element%21FormElement.php/class/FormElement | ||
* @see \Drupal\Core\Render\Element\RenderElement | ||
* @see https://api.drupal.org/api/drupal/namespace/Drupal%21Core%21Render%21Element | ||
* @see \Drupal\os2forms_nemid\Element\NemidKommunekode | ||
*/ | ||
class NemidKommunekode extends NemidElementBase { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getInfo() { | ||
$class = get_class($this); | ||
return parent::getInfo() + [ | ||
'#process' => [ | ||
[$class, 'processNemidKommunekode'], | ||
[$class, 'processAjaxForm'], | ||
], | ||
'#element_validate' => [ | ||
[$class, 'validateNemidKommunekode'], | ||
], | ||
'#pre_render' => [ | ||
[$class, 'preRenderNemidKommunekode'], | ||
], | ||
'#theme' => 'input__os2forms_nemid_kommunekode', | ||
]; | ||
} | ||
|
||
/** | ||
* Processes a 'os2forms_nemid_kommunekode' element. | ||
*/ | ||
public static function processNemidKommunekode(&$element, FormStateInterface $form_state, &$complete_form) { | ||
// Here you can add and manipulate your element's properties and callbacks. | ||
return $element; | ||
} | ||
|
||
/** | ||
* Webform element validation handler for #type 'os2forms_nemid_kommunekode'. | ||
*/ | ||
public static function validateNemidKommunekode(&$element, FormStateInterface $form_state, &$complete_form) { | ||
// Here you can add custom validation logic. | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public static function preRenderNemidKommunekode(array $element) { | ||
$element = parent::prerenderNemidElementBase($element); | ||
static::setAttributes($element, ['form-text', 'os2forms-nemid-kommunekode']); | ||
return $element; | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
modules/os2forms_nemid/src/Plugin/WebformElement/NemidKommunekode.php
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,27 @@ | ||
<?php | ||
|
||
namespace Drupal\os2forms_nemid\Plugin\WebformElement; | ||
|
||
/** | ||
* Provides a 'os2forms_nemid_kommunekode' element. | ||
* | ||
* @WebformElement( | ||
* id = "os2forms_nemid_kommunekode", | ||
* label = @Translation("NemID Kommunekode"), | ||
* description = @Translation("Provides a NemID Kommunekode element."), | ||
* category = @Translation("NemID"), | ||
* ) | ||
* | ||
* @see \Drupal\os2forms_nemid\Plugin\NemidElementBase | ||
* @see \Drupal\os2forms_nemid\Element\NemidKommunekode | ||
*/ | ||
class NemidKommunekode extends ServiceplatformenCprElementBase implements NemidElementPersonalInterface { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getPrepopulateFieldFieldKey() { | ||
return 'kommunekode'; | ||
} | ||
|
||
} |
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