Files
edlp_d8/web/modules/custom/edlp_studio/includes/composition.inc
T
bachir 9da6cf9927 reinstalled all contribs with composer
need to run :
drush ev 'drupal_flush_all_caches();'
drush cr
and restart nginx and php-fpm before loading the website
2019-04-30 19:27:47 +02:00

41 lines
1.1 KiB
PHP

<?php
use Drupal\Core\Render\Element;
/**
* Prepares variables for Composition templates.
*
* Default template: composition.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function template_preprocess_composition(array &$vars) {
// dpm($variables);
// Fetch Composition Entity Object.
/** @var \Drupal\edlp_studio\CompositionInterface $composition */
$composition = $vars['elements']['#composition'];
$vars['view_mode'] = $vars['elements']['#view_mode'];
// $vars['name'] = $composition->getName();
// unset($vars['elements']['name']);
// $variables['page'] = $variables['view_mode'] == 'full' && taxonomy_term_is_page($term);
$vars['url'] = $composition->url();
$vars['attributes']['cid'] = $composition->id();
$vars['attributes']['class'] = array('composition');
// Helpful $content variable for templates.
foreach (Element::children($vars['elements']) as $key) {
$vars['content'][$key] = $vars['elements'][$key];
}
// dpm($vars);
}