Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: UN-OCHA/gtm_barebones
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.2
Choose a base ref
...
head repository: UN-OCHA/gtm_barebones
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.1.3
Choose a head ref
  • 2 commits
  • 6 files changed
  • 1 contributor

Commits on Jul 11, 2024

  1. Copy the full SHA
    d507612 View commit details

Commits on Jul 17, 2024

  1. Merge pull request #4 from UN-OCHA/update-from-upstream

    chore: update from upstream
    lazysoundsystem authored Jul 17, 2024
    Copy the full SHA
    aa5e892 View commit details
Showing with 24 additions and 22 deletions.
  1. +10 −0 README.md
  2. +2 −2 composer.json
  3. +2 −4 gtm_barebones.info.yml
  4. +2 −2 gtm_barebones.module
  5. +6 −0 gtm_barebones.services.yml
  6. +2 −14 src/Hooks/GtmBarebonesHooks.php
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -15,6 +15,16 @@ $config['gtm_barebones.settings']['environment_id'] = 'env-123456';
$config['gtm_barebones.settings']['environment_token'] = 'iBN8NANliiuqnAAi81LapqkkdUIjak';
```

# CSP (Content Security Policy)

If your site enforces CSP, you must add configure CSP directives.

Consider using the [CSP module](https://www.drupal.org/project/csp)

Then add the directives in https://developers.google.com/tag-platform/security/guides/csp

Note the extra directives required for things like Preview mode, and Google Analytics integration.

## License

This program is free software; you can redistribute it and/or modify
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
"description": "OCHA fork of GTM Barebones.",
"type": "drupal-module",
"require": {
"php": ">=8.1",
"drupal/core": "^9.5 || ^10"
"php": ">=8.2",
"drupal/core": "^10.2 || ^11"
}
}
6 changes: 2 additions & 4 deletions gtm_barebones.info.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Barebones GTM (OCHA)
type: module
description: Just the essentials.
core_version_requirement: ^9.5 || ^10
php: 8.1
core_version_requirement: ^10.2 || ^11
php: 8.2
package: SEO
dependencies:
- drupal:system (>=8.6)
4 changes: 2 additions & 2 deletions gtm_barebones.module
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ use Drupal\gtm_barebones\Hooks\GtmBarebonesHooks;
*/
function gtm_barebones_page_attachments(array &$attachments): void {
/** @var \Drupal\gtm_barebones\Hooks\GtmBarebonesHooks $hooks */
$hooks = \Drupal::classResolver(GtmBarebonesHooks::class);
$hooks = \Drupal::service(GtmBarebonesHooks::class);
$hooks->pageAttachments($attachments);
}

@@ -18,6 +18,6 @@ function gtm_barebones_page_attachments(array &$attachments): void {
*/
function gtm_barebones_page_top(array &$page_top): void {
/** @var \Drupal\gtm_barebones\Hooks\GtmBarebonesHooks $hooks */
$hooks = \Drupal::classResolver(GtmBarebonesHooks::class);
$hooks = \Drupal::service(GtmBarebonesHooks::class);
$hooks->pageTop($page_top);
}
6 changes: 6 additions & 0 deletions gtm_barebones.services.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
services:
_defaults:
autowire: true
autoconfigure: true

Drupal\gtm_barebones\Hooks\GtmBarebonesHooks: ~

gtm_barebones.gtm_controller:
class: \Drupal\gtm_barebones\Controller\GtmBarebonesController
16 changes: 2 additions & 14 deletions src/Hooks/GtmBarebonesHooks.php
Original file line number Diff line number Diff line change
@@ -6,35 +6,23 @@

use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Render\Markup;
use Drupal\Core\Routing\AdminContext;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Hooks.
*/
final class GtmBarebonesHooks implements ContainerInjectionInterface {
final class GtmBarebonesHooks {

/**
* Constructor.
*/
private function __construct(
public function __construct(
private readonly ConfigFactoryInterface $configFactory,
protected AdminContext $adminContext,
) {
}

/**
* {@inheritdoc}
*/
final public static function create(ContainerInterface $container): static {
return new static(
$container->get('config.factory'),
$container->get('router.admin_context'),
);
}

/**
* Implements hook_page_attachments().
*