-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UHF-10908: Added hdbt_cookie_banner_test module to alter settings in …
…tests.
- Loading branch information
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...hdbt_cookie_banner/tests/modules/hdbt_cookie_banner_test/hdbt_cookie_banner_test.info.yml
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,4 @@ | ||
name: 'HDBT cookie banner test module' | ||
type: module | ||
package: Custom | ||
core_version_requirement: ^10 || ^11 |
18 changes: 18 additions & 0 deletions
18
...s/hdbt_cookie_banner/tests/modules/hdbt_cookie_banner_test/hdbt_cookie_banner_test.module
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,18 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Contains hooks for hdbt cookie banner test module. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Implements hook_page_attachments(). | ||
*/ | ||
function hdbt_cookie_banner_test_page_attachments(array &$attachments) : void { | ||
// Alter the HDBT cookie banner settings. | ||
$attachments['#attached']['drupalSettings']['hdbt_cookie_banner']['spacerParentSelector'] = '.test-footer'; | ||
global $base_url; | ||
$attachments['#attached']['drupalSettings']['hdbt_cookie_banner']['apiUrl'] = $base_url . '/api/cookie-banner'; | ||
} |
7 changes: 7 additions & 0 deletions
7
...t_cookie_banner/tests/modules/hdbt_cookie_banner_test/hdbt_cookie_banner_test.routing.yml
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,7 @@ | ||
hdbt_cookie_banner_test.test_route: | ||
path: '/test-page' | ||
defaults: | ||
_controller: '\Drupal\hdbt_cookie_banner_test\Controller\TestController::content' | ||
_title: 'Test Page' | ||
requirements: | ||
_permission: 'access content' |
25 changes: 25 additions & 0 deletions
25
...dbt_cookie_banner/tests/modules/hdbt_cookie_banner_test/src/Controller/TestController.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,25 @@ | ||
<?php | ||
|
||
namespace Drupal\hdbt_cookie_banner_test\Controller; | ||
|
||
use Drupal\Core\Controller\ControllerBase; | ||
|
||
/** | ||
* Provides a test page for the custom module. | ||
*/ | ||
class TestController extends ControllerBase { | ||
|
||
/** | ||
* Test page content. | ||
* | ||
* @return array | ||
* Render array. | ||
*/ | ||
public function content() { | ||
return [ | ||
'#type' => 'inline_template', | ||
'#template' => '<p>Test Content</p><div class="test-footer"></div>', | ||
]; | ||
} | ||
|
||
} |