corpus map data json cahe aware of language

This commit is contained in:
2018-05-02 23:48:28 +02:00
parent e4801a87c6
commit 9399f77eb8
@@ -126,14 +126,15 @@ class CorpusController extends ControllerBase {
'count' => count($nodes), 'count' => count($nodes),
'nodes' => $nodes_data, 'nodes' => $nodes_data,
'entrees' => $entrees, 'entrees' => $entrees,
'langcode' => $current_langcode, 'language' => $current_langcode,
); );
// https://spinningcode.org/2017/05/cached-json-responses-in-drupal-8/ // https://spinningcode.org/2017/05/cached-json-responses-in-drupal-8/
// cache is invalidated in edlp_corpus.module by tags // cache is invalidated in edlp_corpus.module by tags
$data['#cache'] = [ $data['#cache'] = [
'max-age' => \Drupal\Core\Cache\Cache::PERMANENT, 'max-age' => \Drupal\Core\Cache\Cache::PERMANENT,
'tags' => ['rebuild-corpus-cache'] 'tags' => ['rebuild-corpus-cache'],
'contexts' => ['languages:language_content'],
]; ];
// $response = new JsonResponse(); // $response = new JsonResponse();