Initial Drupal 11 with DDEV setup

This commit is contained in:
gluebox
2025-10-08 11:39:17 -04:00
commit 89ef74b305
25344 changed files with 2599172 additions and 0 deletions

View File

@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace Drupal\{{ machine_name }}\Cache\Context;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Cache\Context\{{ interface }};
{% if base_class %}
use Drupal\Core\Cache\Context\{{ base_class }};
{% endif %}
/**
* @todo Add a description for the cache context.
*
* Cache context ID: '{{ context_id }}'.
*
* @DCG
* Check out the core/lib/Drupal/Core/Cache/Context directory for examples of
* cache contexts provided by Drupal core.
*/
final class {{ class }} {% if base_class %}extends {{ base_class }} {% endif %}implements {{ interface }} {
/**
* {@inheritdoc}
*/
public static function getLabel(): string {
return (string) t('{{ context_label }}');
}
/**
* {@inheritdoc}
*/
public function getContext({% if calculated %}$parameter = NULL{% endif %}): string {
// @todo Calculate the cache context here.
$context = 'some_string_value';
return $context;
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata({% if calculated %}$parameter = NULL{% endif %}): CacheableMetadata {
return new CacheableMetadata();
}
}

View File

@ -0,0 +1,10 @@
services:
cache_context.{{ context_id }}:
class: Drupal\{{ machine_name }}\Cache\Context\{{ class }}
{% if base_class == 'RequestStackCacheContextBase' %}
arguments: ['@request_stack']
{% elseif base_class == 'UserCacheContextBase' %}
arguments: ['@current_user']
{% endif %}
tags:
- { name: cache.context}