block.block.php
Блок «Раздел»
Вызывается из:
cms/html/block/block.menu.php
cms/html/block/block.html.php
cms/html/block/block.b.php
cms/html/block/block.gallery.php
cms/html/block/block.accordion.php
cms/html/block/block.tab.php
cms/html/block/block.table.php
cms/html/block/block.2col.php
Исходный код
<?php
$panel = $App->get('block')->displayBlockPanel($Page, $block);
$section = $block['data']['section'];
$container = $Page->info['no-container'] && !$block['data']['no-container'];
if ($section) {
$classNames = array('cms-block-section', 'cms-block-section--' . $block['block'], ' uk-section');
$attributes = array();
if ($block['data']['section-options']) foreach (is_array($block['data']['section-options']) ? $block['data']['section-options'] : explode('|', $block['data']['section-options']) as $option) if ($option) {
if (substr($option, 0, 3) === 'uk-') $classNames[] = $option;
if ($option === 'background-image') if ($image = $block['data']['background-image']) $attributes[] = 'style="background-image:url(\'' . htmlspecialchars($image) . '\');"';
}
print '<section class="' . implode(' ', $classNames) . '"' . ($attributes ? ' ' . implode(' ', $attributes) : '') . '>';
print $panel;
$panel = null;
}
if ($container) {
print '<div class="cms-block-container cms-block-container--' . $block['block'] . ' uk-container">';
print $panel;
$panel = null;
}
$title = null;
$inner = false;
if (strlen($title = strval($block['data']['title']))) {
switch (strval($block['data']['no-title'])) {
case 'Y':
$title = null;
break;
case 'inner-h1':
$inner = true;
case 'h1':
$title = '<h1 class="cms-block-title cms-block-title--' . $block['block'] . '">' . htmlspecialchars($title) . '</h1>';
break;
case 'inner-div-h1':
$inner = true;
case 'div-h1':
$title = '<div class="h1 cms-block-title cms-block-title--' . $block['block'] . '">' . htmlspecialchars($title) . '</div>';
break;
case 'inner-h2':
$inner = true;
case 'h2':
$title = '<h2 class="cms-block-title cms-block-title--' . $block['block'] . '">' . htmlspecialchars($title) . '</h2>';
break;
case 'inner-h3':
$inner = true;
case 'h3':
$title = '<h3 class="cms-block-title cms-block-title--' . $block['block'] . '">' . htmlspecialchars($title) . '</h3>';
break;
case 'inner-h4':
$inner = true;
case 'h4':
$title = '<h4 class="cms-block-title cms-block-title--' . $block['block'] . '">' . htmlspecialchars($title) . '</h4>';
break;
default:
$title = '<h2 class="cms-block-title cms-block-title--' . $block['block'] . '">' . htmlspecialchars($title) . '</h2>';
break;
}
}
if (!$inner && $title) print $title;
?>
<div class="cms-block-content cms-block-content--<?=$block['block']?> uk-clearfix">
<?php if ($inner) print $title; ?>
<?=$panel?>
<?=$html?>
</div>
<?php
if ($container) print '</div>';
if ($section) print '</section>';
?>