Prepares variables for paragraph templates.
Default template: paragraph.html.twig.
Most themes use their own copy of paragraph.html.twig. The default is located inside "templates/paragraph.html.twig". Look in there for the full list of variables.
array $variables: An associative array containing:
function template_preprocess_paragraph(&$variables) {
$variables['view_mode'] = $variables['elements']['#view_mode'];
$variables['paragraph'] = $variables['elements']['#paragraph'];
// Helpful $content variable for templates.
$variables += array(
'content' => array(),
);
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
$paragraph_type = $variables['elements']['#paragraph']
->getParagraphType();
foreach ($paragraph_type
->getEnabledBehaviorPlugins() as $plugin_value) {
$plugin_value
->preprocess($variables);
}
}