decoupled_json_log-1.0.x-dev/decoupled_json_log.module
decoupled_json_log.module
<?php
/**
* @file
* Provides a json log entity type.
*/
declare(strict_types=1);
use Drupal\Core\Render\Element;
/**
* Prepares variables for json log templates.
*
* Default template: log-json.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the json log info and any
* fields attached to the entity.
* - attributes: HTML attributes for the containing element.
*/
function template_preprocess_log_json(array &$variables): void {
$variables['view_mode'] = $variables['elements']['#view_mode'];
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
}
