Initial Drupal 11 with DDEV setup
This commit is contained in:
41
vendor/chi-teck/drupal-code-generator/templates/Service/_request-policy/request-policy.twig
vendored
Normal file
41
vendor/chi-teck/drupal-code-generator/templates/Service/_request-policy/request-policy.twig
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
{% import '@lib/di.twig' as di %}
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\{{ machine_name }}\PageCache;
|
||||
|
||||
{% apply sort_namespaces %}
|
||||
use Drupal\Core\PageCache\RequestPolicyInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
{% if services %}
|
||||
{{ di.use(services) }}
|
||||
{% endif %}
|
||||
{% endapply %}
|
||||
|
||||
/**
|
||||
* @todo Add policy description here.
|
||||
*/
|
||||
final class {{ class }} implements RequestPolicyInterface {
|
||||
{% if services %}
|
||||
|
||||
/**
|
||||
* Constructs {{ class|article }} object.
|
||||
*/
|
||||
public function __construct(
|
||||
{{ di.signature(services) }}
|
||||
) {}
|
||||
{% endif %}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function check(Request $request): ?string {
|
||||
// @DCG
|
||||
// Return self::ALLOW or self::DENY to indicate whether delivery of a cached
|
||||
// page should be attempted for this request. Return NULL if the policy does
|
||||
// not apply to the given request.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
9
vendor/chi-teck/drupal-code-generator/templates/Service/_request-policy/services.twig
vendored
Normal file
9
vendor/chi-teck/drupal-code-generator/templates/Service/_request-policy/services.twig
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
{% import '@lib/di.twig' as di %}
|
||||
services:
|
||||
{{ machine_name }}.page_cache_request_policy.{{ class|c2m }}:
|
||||
class: Drupal\{{ machine_name }}\PageCache\{{ class }}
|
||||
{% if services %}
|
||||
arguments: [{{ di.arguments(services) }}]
|
||||
{% endif %}
|
||||
tags:
|
||||
- { name: page_cache_request_policy }
|
||||
Reference in New Issue
Block a user