function THEMENAME_preprocess_html(array &$vars): void {
if (
\Drupal::routeMatch()->getRouteName() == 'entity.node.canonical' &&
$node = \Drupal::routeMatch()->getParameter('node')
) {
foreach ($node->get('field_paragraphs') as $item) {
$paragraph = $item->entity;
if ($paragraph->bundle() == 'ad_section' && !$paragraph->get('field_video')->isEmpty()) {
$vars['attributes']['class'][] = 'has-video';
}
}
}
}
// THEMENAME.theme
function THEMENAME_preprocess_node__NODE_ID(array &$vars) {
$webform_build = [
'#type' => 'webform',
'#webform' => 'WEBFORM_ID',
];
$vars['content']['body'][0]['#text'] = str_replace('[webform]', render($webform_build), $vars['content']['body'][0]['#text']);
}
<ul>
<li class="my-row-class">строка 1</li>
<li class="my-row-class">строка 2</li>
<li class="my-row-class">строка ...</li>
</ul>
<ul>
<li class="views-row my-row-class">строка 1</li>
<li class="views-row my-row-class">строка 2</li>
<li class="views-row my-row-class">строка ...</li>
</ul>
function THEMENAME_theme_suggestions_page_alter(array &$suggestions, array $variables) {
$route_match = \Drupal::routeMatch();
if ($route_match->getRouteName() == 'entity.node.canonical') {
$suggestions[] = 'page__' . $route_match->getParameter('node')->bundle();
}
}
page--NODE-TYPE.html.twig