Skip to content

Commit

Permalink
UHF-10908: Added hdbt_cookie_banner_test module to alter settings in …
Browse files Browse the repository at this point in the history
…tests.
  • Loading branch information
khalima committed Dec 4, 2024
1 parent 900be57 commit 870a12e
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
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
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';
}
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'
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>',
];
}

}

0 comments on commit 870a12e

Please sign in to comment.