Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
45
vendor/chi-teck/drupal-code-generator/templates/d8/service/cache-context.twig
vendored
Normal file
45
vendor/chi-teck/drupal-code-generator/templates/d8/service/cache-context.twig
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
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 %}
|
||||
|
||||
/**
|
||||
* Defines the ExampleCacheContext service.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
class {{ class }} {% if base_class %}extends {{ base_class }} {% endif %}implements {{ interface }} {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getLabel() {
|
||||
return t('{{ context_label }}');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContext({% if calculated %}$parameter = NULL{% endif %}) {
|
||||
// @DCG: Define the cache context here.
|
||||
$context = 'some_string_value';
|
||||
return $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCacheableMetadata({% if calculated %}$parameter = NULL{% endif %}) {
|
||||
return new CacheableMetadata();
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue