Skip to content

Commit

Permalink
Merge pull request #59 from OS2Forms/f/OS-58_company_elements
Browse files Browse the repository at this point in the history
F/os 58 company elements
  • Loading branch information
skifter authored Sep 19, 2023
2 parents 20d560e + ad19d38 commit f9a13ce
Show file tree
Hide file tree
Showing 13 changed files with 578 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ before starting to add changes. Use example [placed in the end of the page](#exa

## [Unreleased]

- [OS-58] New company address fields

## [3.10.0] 2023-08-23

- [OSF-55] DAWA Address-Matrikula (autocomplete) (required)
Expand Down
67 changes: 67 additions & 0 deletions modules/os2forms_nemid/src/Element/NemidCompanyApartmentNr.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

namespace Drupal\os2forms_nemid\Element;

use Drupal\Core\Form\FormStateInterface;

/**
* Provides a 'os2forms_nemid_company_apartment_nr'.
*
* @FormElement("os2forms_nemid_company_apartment_nr")
*
* @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\NemidCompanyApartmentNr
*/
class NemidCompanyApartmentNr extends NemidElementBase {

/**
* {@inheritdoc}
*/
public function getInfo() {
$class = get_class($this);
return parent::getInfo() + [
'#process' => [
[$class, 'processNemidCompanyApartmentNr'],
[$class, 'processAjaxForm'],
],
'#element_validate' => [
[$class, 'validateNemidCompanyApartmentNr'],
],
'#pre_render' => [
[$class, 'preRenderNemidCompanyApartmentNr'],
],
'#theme' => 'input__os2forms_nemid_company_apartment_nr',
];
}

/**
* Processes a 'os2forms_nemid_company_apartment_nr' element.
*/
public static function processNemidCompanyApartmentNr(&$element, FormStateInterface $form_state, &$complete_form) {
// Here you can add and manipulate your element's properties and callbacks.
return $element;
}

/**
* Webform element validation for 'os2forms_nemid_company_apartment_nr'.
*/
public static function validateNemidCompanyApartmentNr(&$element, FormStateInterface $form_state, &$complete_form) {
// Here you can add custom validation logic.
}

/**
* {@inheritdoc}
*/
public static function preRenderNemidCompanyApartmentNr(array $element) {
$element = parent::prerenderNemidElementBase($element);
static::setAttributes($element, [
'form-text',
'os2forms-nemid-company-apartment-nr',
]);
return $element;
}

}
67 changes: 67 additions & 0 deletions modules/os2forms_nemid/src/Element/NemidCompanyFloor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

namespace Drupal\os2forms_nemid\Element;

use Drupal\Core\Form\FormStateInterface;

/**
* Provides a 'os2forms_nemid_company_floor'.
*
* @FormElement("os2forms_nemid_company_floor")
*
* @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\NemidCompanyFloor
*/
class NemidCompanyFloor extends NemidElementBase {

/**
* {@inheritdoc}
*/
public function getInfo() {
$class = get_class($this);
return parent::getInfo() + [
'#process' => [
[$class, 'processNemidCompanyFloor'],
[$class, 'processAjaxForm'],
],
'#element_validate' => [
[$class, 'validateNemidCompanyFloor'],
],
'#pre_render' => [
[$class, 'preRenderNemidCompanyFloor'],
],
'#theme' => 'input__os2forms_nemid_company_floor',
];
}

/**
* Processes a 'os2forms_nemid_company_floor' element.
*/
public static function processNemidCompanyFloor(&$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 'os2forms_nemid_company_floor'.
*/
public static function validateNemidCompanyFloor(&$element, FormStateInterface $form_state, &$complete_form) {
// Here you can add custom validation logic.
}

/**
* {@inheritdoc}
*/
public static function preRenderNemidCompanyFloor(array $element) {
$element = parent::prerenderNemidElementBase($element);
static::setAttributes($element, [
'form-text',
'os2forms-nemid-company-floor',
]);
return $element;
}

}
67 changes: 67 additions & 0 deletions modules/os2forms_nemid/src/Element/NemidCompanyHouseNr.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

namespace Drupal\os2forms_nemid\Element;

use Drupal\Core\Form\FormStateInterface;

/**
* Provides a 'os2forms_nemid_company_house_nr'.
*
* @FormElement("os2forms_nemid_company_house_nr")
*
* @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\NemidCompanyHouseNr
*/
class NemidCompanyHouseNr extends NemidElementBase {

/**
* {@inheritdoc}
*/
public function getInfo() {
$class = get_class($this);
return parent::getInfo() + [
'#process' => [
[$class, 'processNemidCompanyHouseNr'],
[$class, 'processAjaxForm'],
],
'#element_validate' => [
[$class, 'validateNemidCompanyHouseNr'],
],
'#pre_render' => [
[$class, 'preRenderNemidCompanyHouseNr'],
],
'#theme' => 'input__os2forms_nemid_company_house_nr',
];
}

/**
* Processes a 'os2forms_nemid_company_house_nr' element.
*/
public static function processNemidCompanyHouseNr(&$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 'os2forms_nemid_company_house_nr'.
*/
public static function validateNemidCompanyHouseNr(&$element, FormStateInterface $form_state, &$complete_form) {
// Here you can add custom validation logic.
}

/**
* {@inheritdoc}
*/
public static function preRenderNemidCompanyHouseNr(array $element) {
$element = parent::prerenderNemidElementBase($element);
static::setAttributes($element, [
'form-text',
'os2forms-nemid-company-house-nr',
]);
return $element;
}

}
67 changes: 67 additions & 0 deletions modules/os2forms_nemid/src/Element/NemidCompanyKommunekode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

namespace Drupal\os2forms_nemid\Element;

use Drupal\Core\Form\FormStateInterface;

/**
* Provides a 'os2forms_nemid_company_kommunekode'.
*
* @FormElement("os2forms_nemid_company_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\NemidCompanyKommunekode
*/
class NemidCompanyKommunekode extends NemidElementBase {

/**
* {@inheritdoc}
*/
public function getInfo() {
$class = get_class($this);
return parent::getInfo() + [
'#process' => [
[$class, 'processNemidCompanyKommunekode'],
[$class, 'processAjaxForm'],
],
'#element_validate' => [
[$class, 'validateNemidCompanyKommunekode'],
],
'#pre_render' => [
[$class, 'preRenderNemidCompanyKommunekode'],
],
'#theme' => 'input__os2forms_nemid_company_kommunekode',
];
}

/**
* Processes a 'os2forms_nemid_company_kommunekode' element.
*/
public static function processNemidCompanyKommunekode(&$element, FormStateInterface $form_state, &$complete_form) {
// Here you can add and manipulate your element's properties and callbacks.
return $element;
}

/**
* Webform element validation for 'os2forms_nemid_company_kommunekode'.
*/
public static function validateNemidCompanyKommunekode(&$element, FormStateInterface $form_state, &$complete_form) {
// Here you can add custom validation logic.
}

/**
* {@inheritdoc}
*/
public static function preRenderNemidCompanyKommunekode(array $element) {
$element = parent::prerenderNemidElementBase($element);
static::setAttributes($element, [
'form-text',
'os2forms-nemid-company-kommunekode',
]);
return $element;
}

}
67 changes: 67 additions & 0 deletions modules/os2forms_nemid/src/Element/NemidCompanyPostalCode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

namespace Drupal\os2forms_nemid\Element;

use Drupal\Core\Form\FormStateInterface;

/**
* Provides a 'os2forms_nemid_company_postal_code'.
*
* @FormElement("os2forms_nemid_company_postal_code")
*
* @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\NemidCompanyPostalCode
*/
class NemidCompanyPostalCode extends NemidElementBase {

/**
* {@inheritdoc}
*/
public function getInfo() {
$class = get_class($this);
return parent::getInfo() + [
'#process' => [
[$class, 'processNemidCompanyPostalCode'],
[$class, 'processAjaxForm'],
],
'#element_validate' => [
[$class, 'validateNemidCompanyPostalCode'],
],
'#pre_render' => [
[$class, 'preRenderNemidCompanyPostalCode'],
],
'#theme' => 'input__os2forms_nemid_company_postal_code',
];
}

/**
* Processes a 'os2forms_nemid_company_postal_code' element.
*/
public static function processNemidCompanyPostalCode(&$element, FormStateInterface $form_state, &$complete_form) {
// Here you can add and manipulate your element's properties and callbacks.
return $element;
}

/**
* Webform element validation for 'os2forms_nemid_company_postal_code'.
*/
public static function validateNemidCompanyPostalCode(&$element, FormStateInterface $form_state, &$complete_form) {
// Here you can add custom validation logic.
}

/**
* {@inheritdoc}
*/
public static function preRenderNemidCompanyPostalCode(array $element) {
$element = parent::prerenderNemidElementBase($element);
static::setAttributes($element, [
'form-text',
'os2forms-nemid-company-postal-code',
]);
return $element;
}

}
Loading

0 comments on commit f9a13ce

Please sign in to comment.