Files
wordpress-theme-aksrt/src/WidgetSystem/WidgetCatalog.php
T
kate522 b639d57c5b feat(widgets): replicate 12 reference widgets for full Zibll parity
- rewrite schemas for posts, tab_posts, oneline_posts, hot_posts,
  term_cards, term_aggregation, media_cards, combo_info, partners,
  recent_comments, posts_toc and slider_media_combo to mirror the
  modern reference modules field by field (options, defaults,
  dependencies, min/max/step, subheadings)
- port reference renderers: hot ranking with TOP badges, category
  aggregation card, graphic cover cards, partners CSS marquee,
  combo info cards with auto band palette, recent comment list
- rename 分类与标签聚合卡片 to 分类聚合卡片 and restrict it to
  categories (no tags/topics branch in this project)
- drop topics filter fields and the topics query branch; align
  orderby value domain with supported post meta
- add searchable sortable terms admin field type and spinner unit
  suffix rendering
- unify widget pagination and lazy loading on the REST client with
  the runtime-owned ias reveal trigger; remove the legacy
  post_ajax_trigger dual path
- align section-navs TOC with the reference contract (wznav ids,
  3-heading minimum, zib-widget box)
2026-09-05 11:28:00 +08:00

99 lines
5.0 KiB
PHP

<?php
namespace AKSRT\WidgetSystem;
defined('ABSPATH') || exit;
/**
* Canonical catalog of the 37 modern AKSRT widgets.
*/
final class WidgetCatalog {
public static function definitions(): array {
$groups = [
'general' => [
['search', '搜索框', '显示多种样式的站内搜索框', 'sidebar'],
['posts_toc', '文章目录树', '显示当前文章的标题目录', 'sidebar'],
['quote', '一言', '定时切换本地或在线句子', 'sidebar'],
['icon_cards', '图标卡片(竖版)', '图标在文字上方的特色卡片', 'wide'],
['video', '视频', '支持常规视频与流媒体格式', 'any'],
['embed', '超级嵌入', '按比例嵌入外部在线内容', 'any'],
['media_cards', '图文视频封面卡片', '显示图片、视频和文字封面卡片', 'wide'],
['icon_cover_cards', '图标卡片(横版)', '图标在文字左侧的特色卡片', 'wide'],
['partners', '横向滚动合作伙伴', '多行自动滚动的合作伙伴或案例列表', 'wide'],
['combo_info', '复合信息卡片', '组合图标、标签、简介和按钮的信息卡', 'wide'],
['text_title', '文字标题', '独立的标题与简介模块', 'wide'],
['buttons', '按钮组', '单个或多个跳转按钮', 'wide'],
['layout_gap', '布局额外间距', '增加 PC 与移动端模块间距', 'wide'],
['tag_cloud', '标签云', '彩色显示标签或分类', 'sidebar'],
['recent_comments', '最近评论', '显示网站最新评论', 'sidebar'],
['links', '链接列表', '友情链接和网址导航列表', 'wide'],
['notice', '上下滚动公告', '自动滚动的公告信息列表', 'wide'],
],
'content' => [
['term_cards', '分类图文卡片', '将分类显示为图文卡片', 'wide'],
['term_aggregation', '分类聚合卡片', '将分类显示为图文聚合卡片,并附带最新文章列表', 'wide'],
['hot_posts', '热榜文章', '按浏览、点赞、评论、收藏等维度生成榜单', 'sidebar'],
['post_pay', '付费购买', '显示当前文章的知识付费购买模块', 'sidebar'],
['posts', '文章列表', '通过各种筛选、排序显示文章列表,支持多种显示模式', 'wide'],
['tab_posts', '多栏目文章(新)', '通过多个栏目切换文章列表', 'wide'],
['oneline_posts', '横向滚动文章', '显示文章列表,只显示一行,左右滚动', 'wide'],
],
'knowledge_product' => [
['pricing_plans', '知识产品方案卡片', '课程与会员方案价格、权益和购买入口', 'wide'],
['reviews', '知识产品评价', '横向滑动的学员或会员评价', 'wide'],
['faq', '知识产品常见问题', '支持搜索的常见问题与帮助卡片', 'wide'],
['stats', '知识产品数据展示', '横排数字统计展示模块', 'wide'],
['highlights', '知识产品亮点卡片', '多尺寸知识产品亮点聚合', 'wide'],
['feature_intro', '知识产品图文亮点', '可切换媒体的左右图文介绍', 'wide'],
['tilt_cases', '知识产品 3D 展示', '带 3D 交互的知识产品案例展示', 'wide'],
],
'slider' => [
['slider', '幻灯片(新)', '支持图片、视频、文字和视差图层', 'wide'],
['slider_media_combo', '幻灯片加图文视频卡片', '左侧幻灯片与右侧图文视频封面卡片横向组合展示', 'wide'],
],
'user' => [
['user_card', '用户个人信息', '未登录时候显示登录注册按钮,登录后显示登录用户的个人信息', 'sidebar'],
['author_card', '文章作者信息', '显示当前文章作者的个人信息,只会在文章页显示', 'sidebar'],
['user_ranking', '用户排行榜', '按签到、积分或粉丝生成排行', 'sidebar'],
['user_list', '用户列表', '筛选并显示注册用户列表', 'wide'],
],
];
$definitions = [];
foreach ($groups as $group => $items) {
foreach ($items as [$slug, $name, $description, $size]) {
$definitions[] = [
'slug' => $slug,
'name' => 'AKSRT ' . $name,
'description' => $description,
'group' => $group,
'renderer' => $slug,
'size' => $size,
'common' => [
'title' => !in_array($slug, ['post_pay', 'layout_gap', 'slider', 'slider_media_combo', 'buttons', 'posts_toc'], true),
'affix' => ($size === 'sidebar' && $slug !== 'posts_toc') || in_array($slug, ['buttons', 'notice'], true),
'animation' => !in_array($slug, ['buttons', 'term_cards', 'term_aggregation', 'media_cards', 'combo_info', 'slider_media_combo'], true),
],
'fields' => WidgetSchemas::for($slug),
'assets' => self::assets($slug),
];
}
}
return $definitions;
}
private static function assets(string $slug): array {
if (in_array($slug, ['slider', 'slider_media_combo', 'reviews', 'oneline_posts'], true)) {
return ['swiper'];
}
if ($slug === 'video') {
return ['dplayer', 'hls', 'flv', 'dash'];
}
if ($slug === 'tilt_cases') {
return ['tilt'];
}
return [];
}
}