layout_paragraphs-1.0.x-dev/tests/modules/layout_paragraphs_custom_host_entity_test/layout_paragraphs_custom_host_entity_test.module
tests/modules/layout_paragraphs_custom_host_entity_test/layout_paragraphs_custom_host_entity_test.module
<?php
/**
* @file
* Provides a lp host entity entity type.
*/
use Drupal\Core\Render\Element;
/**
* Implements hook_theme().
*/
function layout_paragraphs_custom_host_entity_test_theme() {
return [
'lp_host_entity' => [
'render element' => 'elements',
],
];
}
/**
* Prepares variables for lp host entity templates.
*
* Default template: lp-host-entity.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the lp host entity information
* and any fields attached to the entity.
* - attributes: HTML attributes for the containing element.
*/
function template_preprocess_lp_host_entity(array &$variables) {
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
}
