forked from laysense/laysite
Launch LaySite visual editor and MCP workspace
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$canvas ??= false;
|
||||
$body = $section['body'];
|
||||
$dynamic = isset($section['feed']);
|
||||
$studio = $canvas ? ' data-studio-section="' . $e($section['version']) . '" data-studio-source="' . $e(base64_encode($section['body'])) . '"' : '';
|
||||
if ($canvas && $dynamic) {
|
||||
$studio .= ' data-studio-dynamic data-studio-feed="' . $e($section['feed']) . '" tabindex="0"';
|
||||
}
|
||||
if ($section['style'] === 'hero-links'):
|
||||
?>
|
||||
<div class="wrap hero-directory-slot" id="<?= $e($section['key']) ?>"<?= $studio ?>>
|
||||
<?php if ($canvas): ?><span data-studio-part="title" hidden><?= $e($section['title']) ?></span><span data-studio-part="lead" hidden><?= $e($section['lead']) ?></span><?php endif ?>
|
||||
<div<?= $canvas ? ' data-studio-part="body"' : '' ?>><?= $body ?></div>
|
||||
</div>
|
||||
<?php
|
||||
return;
|
||||
endif;
|
||||
|
||||
$alignments = json_decode($section['alignments'] ?? '{}', true, flags: JSON_THROW_ON_ERROR);
|
||||
if ($dynamic && $body === '<p><a class="back-link" href="/articles">查看全部动态</a></p>') {
|
||||
$body = '';
|
||||
}
|
||||
$network = $section['networkFeed'] ?? false;
|
||||
$catalog = $section['catalogFeed'] ?? false;
|
||||
?>
|
||||
<section class="section section-<?= $e($section['style']) ?><?= $network ? ' network' : '' ?>" id="<?= $e($section['key']) ?>" aria-labelledby="heading-<?= $e($section['key']) ?>" <?= $moment ? 'data-moment="iris-opens"' : '' ?><?= $studio ?>>
|
||||
<div class="wrap">
|
||||
<div class="section-heading">
|
||||
<h2 id="heading-<?= $e($section['key']) ?>"<?= isset($alignments['title']) ? ' class="' . trim(View::alignmentClass($alignments['title'])) . '"' : '' ?><?= $canvas ? ' data-studio-part="title"' : '' ?>><?= $e($section['title']) ?></h2>
|
||||
<?php if ($canvas || $section['lead']): ?><p<?= isset($alignments['lead']) ? ' class="' . trim(View::alignmentClass($alignments['lead'])) . '"' : '' ?><?= $canvas ? ' data-studio-part="lead"' : '' ?>><?= $e($section['lead']) ?></p><?php endif ?>
|
||||
</div>
|
||||
<?php if ($network): ?>
|
||||
<?php foreach ($section['articleFeed'] as $group): ?>
|
||||
<?php $slug = $group['categories'][0]; $anchor = ($pageSlug ?? '') === 'home' && $section['key'] === 'network' ? $slug : $section['key'] . '-group-' . $slug; ?>
|
||||
<div class="network-group" id="<?= $e($anchor) ?>">
|
||||
<h3><?= $e($group['label']) ?></h3>
|
||||
<?= View::fragment('network-items', ['articles' => $group['articles'], 'standalone' => false]) ?>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
<?php if ($section['archivePath'] !== null): ?><p class="article-feed-archive"><a class="back-link" href="<?= $e($section['archivePath']) ?>">查看全部</a></p><?php endif ?>
|
||||
<?php elseif ($catalog): ?>
|
||||
<?= View::fragment('service-cards', ['products' => $section['articleFeed'][0]['articles']]) ?>
|
||||
<?php if ($section['archivePath'] !== null && count($section['articleFeed'][0]['articles']) >= $section['feedLimit']): ?>
|
||||
<p class="article-feed-archive"><a class="back-link" href="<?= $e($section['archivePath']) ?>">查看全部</a></p>
|
||||
<?php endif ?>
|
||||
<?php elseif (!empty($section['articleFeed'])): ?>
|
||||
<?= View::fragment('article-feed', ['groups' => $section['articleFeed'], 'sectionKey' => $section['key'], 'archivePath' => $section['archivePath']]) ?>
|
||||
<?php endif ?>
|
||||
<?php if ($canvas || $body !== ''): ?><div class="rich<?= $dynamic ? ' article-feed-note' : '' ?>"<?= $canvas ? ' data-studio-part="body"' : '' ?>><?= $body ?></div><?php endif ?>
|
||||
</div>
|
||||
</section>
|
||||
Reference in New Issue
Block a user