$content .= '<component src="bearcms-image-element" bearcms-internal-attribute-raw-data="' . htmlentities(json_encode($imageElementData)) . '"/>';
                }
                if ($textElementData !== null) {
                    $content .= '<component src="bearcms-text-element" bearcms-internal-attribute-raw-data="' . htmlentities(json_encode($textElementData)) . '"/>';
                }
            } else {
                $content .= '<component src="bearcms-elements" id="' . $containerID . '"/>';
            }
            $content .= '</div>';
        }
        //}
        //    if (isset($postContent{0})) {
        //        $content .= '<div class="bearcms-blog-posts-element-post-more-link-container">';
        //        $content .= '<a title="' . htmlentities($title) . '" class="bearcms-blog-posts-element-post-more-link" href="' . htmlentities($url) . '">read more</a>';
        //        $content .= '</div>';
        //    }
        $content .= '</div>';
        if ($counter >= $limit) {
            break;
        }
    }
    $content .= '</div>';
}
$content = \BearCMS\Internal\ElementsHelper::getElementComponentContent($component, 'blogPosts', $content);
?>
<html>
    <body><?php 
echo $content;
?>
</body>
</html>
            if ($liPath === $selectedPath) {
                $liClasssName .= ' bearcms-navigation-element-item-selected';
            } elseif ($liPath !== '/' && strpos($selectedPath, $liPath) === 0) {
                $liClasssName .= ' bearcms-navigation-element-item-in-path';
            }
        }
        $liElement->setAttribute('class', trim($liElement->getAttribute('class') . ' ' . $liClasssName));
    }
    $rootULElement = $domDocument->querySelector('ul');
    if ($rootULElement) {
        $itemsHtml = $rootULElement->outerHTML;
    }
} else {
    if ($pages === null || $pages->length === 0) {
        $itemsHtml = '';
    } else {
        $itemsHtml = $buildTree($pages, $type === 'tree');
    }
}
$content = '';
if (isset($itemsHtml[0])) {
    $content = '<component src="navigation-menu"' . $attributes . '>' . $itemsHtml . '</component>';
}
$content = \BearCMS\Internal\ElementsHelper::getElementComponentContent($component, 'navigation', $content);
?>
<html>
    <body><?php 
echo $content;
?>
</body>
</html>
<?php

/*
 * Bear CMS addon for Bear Framework
 * https://bearcms.com/
 * Copyright (c) 2016 Amplilabs Ltd.
 * Free to use under the MIT license.
 */
$code = trim($component->code);
if ($code !== '') {
    $content = '<div class="bearcms-html-element">' . $code . '</div>';
} else {
    $content = '';
}
$content = \BearCMS\Internal\ElementsHelper::getElementComponentContent($component, 'html', $content);
?>
<html>
    <body><?php 
echo $content;
?>
</body>
</html>
    $attributes .= ' columnsCount="' . $component->columnsCount . '"';
}
if (strlen($component->imageSize) > 0) {
    $attributes .= ' imageSize="' . $component->imageSize . '"';
}
if (strlen($component->imageAspectRatio) > 0) {
    $attributes .= ' imageAspectRatio="' . $component->imageAspectRatio . '"';
}
if (strlen($component->imageLoadingBackground) > 0) {
    $attributes .= ' imageLoadingBackground="' . $component->imageLoadingBackground . '"';
}
if (strlen($component->lazyLoadImages) > 0) {
    $attributes .= ' lazyLoadImages="' . $component->lazyLoadImages . '"';
} else {
    $attributes .= ' lazyLoadImages="true"';
}
$content .= '<component src="image-gallery" spacing="' . $spacing . '"' . $attributes . '>';
foreach ($files as $file) {
    $filename = $app->bearCMS->data->getRealFilename($file->getAttribute('filename'));
    $content .= '<file class="bearcms-image-gallery-element-image" filename="' . htmlentities($filename) . '"/>';
}
$content .= '</component>';
$content .= '</div>';
$content = \BearCMS\Internal\ElementsHelper::getElementComponentContent($component, 'imageGallery', $content);
?>
<html>
    <body><?php 
echo $content;
?>
</body>
</html>