feat(post-list): align list schema with Zibll paging contract
Replace the post_list.list admin contract with a dedicated schema module using Zibll keys (paging_ajax_s, paging_ajax_ias_s, ajax_trigger, ajax_nomore, list_orderby, post_list_author/time, target_blank). Runtime derives numbered/load_more/infinite from those keys and applies list orderby on main queries without legacy dual-write layers.
This commit is contained in:
@@ -14,104 +14,7 @@ class AKSRT_Admin_Schema_Post_List {
|
||||
'domain' => 'post_list',
|
||||
'title' => '文章&列表',
|
||||
'sections' => [
|
||||
'list' => [
|
||||
'key' => 'list',
|
||||
'title' => '文章列表',
|
||||
'version' => '1.0.0',
|
||||
'option_key' => 'aksrt_settings',
|
||||
'groups' => [
|
||||
['key' => 'card', 'title' => '卡片样式', 'fields' => [
|
||||
['key' => 'post_card_style', 'label' => '卡片样式', 'type' => 'select', 'default' => 'thumb', 'options' => [
|
||||
['label' => '标准图文', 'value' => 'thumb'],
|
||||
['label' => '紧凑卡', 'value' => 'compact'],
|
||||
['label' => '大图卡', 'value' => 'large_thumb'],
|
||||
['label' => '多图卡', 'value' => 'multi_thumb'],
|
||||
['label' => '纯文字', 'value' => 'text'],
|
||||
['label' => '有图则图文', 'value' => 'thumb_if_has'],
|
||||
['label' => '卡片模式', 'value' => 'card'],
|
||||
]],
|
||||
['key' => 'post_excerpt_length', 'label' => '摘要长度', 'type' => 'number', 'default' => 120, 'min' => 20, 'max' => 500],
|
||||
]],
|
||||
['key' => 'meta', 'title' => '元信息显示', 'fields' => [
|
||||
['key' => 'post_show_author', 'label' => '显示作者', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'post_show_date', 'label' => '显示日期', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'post_show_views', 'label' => '显示浏览数', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'post_show_category', 'label' => '显示分类', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'post_show_tags', 'label' => '显示标签', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'post_show_comments', 'label' => '显示评论数', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'post_show_likes', 'label' => '显示点赞数', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'list_badge_show', 'label' => '显示徽章类型', 'type' => 'checkbox', 'default' => ['pay', 'tag', 'topics', 'cat'], 'options' => [
|
||||
['label' => '付费', 'value' => 'pay'],
|
||||
['label' => '分类', 'value' => 'cat'],
|
||||
['label' => '专题', 'value' => 'topics'],
|
||||
['label' => '标签', 'value' => 'tag'],
|
||||
]],
|
||||
['key' => 'post_list_meta_show', 'label' => '显示元信息', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'list_meta_show', 'label' => '移动端优先部件', 'type' => 'radio', 'default' => 'like', 'options' => [
|
||||
['label' => '浏览数', 'value' => 'view'],
|
||||
['label' => '点赞数', 'value' => 'like'],
|
||||
['label' => '评论数', 'value' => 'comm'],
|
||||
], 'description' => '移动端空间不足时保留显示的单一部件'],
|
||||
]],
|
||||
['key' => 'layout', 'title' => '布局设置', 'fields' => [
|
||||
['key' => 'post_list_columns', 'label' => '列表列数', 'type' => 'number', 'default' => 1, 'min' => 1, 'max' => 3],
|
||||
['key' => 'post_list_per_page', 'label' => '每页文章数', 'type' => 'number', 'default' => 12, 'min' => 4, 'max' => 48],
|
||||
['key' => 'sticky_s', 'label' => '置顶范围', 'type' => 'checkbox', 'default' => ['home', 'cat'], 'options' => [
|
||||
['label' => '首页', 'value' => 'home'],
|
||||
['label' => '分类页', 'value' => 'cat'],
|
||||
['label' => '标签页', 'value' => 'tag'],
|
||||
['label' => '专题页', 'value' => 'topics'],
|
||||
]],
|
||||
['key' => 'post_target_blank', 'label' => '新窗口打开', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'item_heading_bold', 'label' => '标题加粗', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'list_show_type', 'label' => '列表样式', 'type' => 'radio', 'default' => 'separate', 'options' => [
|
||||
['label' => '分隔卡片', 'value' => 'separate'],
|
||||
['label' => '无间距', 'value' => 'no_margin'],
|
||||
]],
|
||||
['key' => 'list_card_home', 'label' => '首页卡片模式', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'list_card_cat', 'label' => '分类卡片模式', 'type' => 'taxonomy_select', 'taxonomy' => 'category', 'multiple' => true, 'default' => []],
|
||||
['key' => 'list_card_tag', 'label' => '标签页卡片模式', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'list_card_topics', 'label' => '专题页卡片模式', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'list_card_author', 'label' => '用户页卡片模式', 'type' => 'switch', 'default' => false],
|
||||
]],
|
||||
['key' => 'pagination', 'title' => '分页方式', 'fields' => [
|
||||
['key' => 'post_pagination_mode', 'label' => '分页模式', 'type' => 'radio', 'default' => 'numbered', 'options' => [
|
||||
['label' => '数字分页', 'value' => 'numbered'],
|
||||
['label' => '加载更多', 'value' => 'load_more'],
|
||||
['label' => '无限滚动', 'value' => 'infinite'],
|
||||
]],
|
||||
['key' => 'ias_max', 'label' => '最大加载页数', 'type' => 'number', 'default' => 3, 'min' => 0, 'max' => 10, 'description' => '0=不限'],
|
||||
['key' => 'ajax_trigger_text', 'label' => '加载更多文案', 'type' => 'input', 'default' => ''],
|
||||
['key' => 'ajax_nomore_text', 'label' => '没有更多文案', 'type' => 'input', 'default' => ''],
|
||||
]],
|
||||
['key' => 'sort', 'title' => '默认排序', 'fields' => [
|
||||
['key' => 'list_orderby', 'label' => '列表默认排序', 'type' => 'radio', 'default' => 'modified', 'options' => [
|
||||
['label' => '更新时间', 'value' => 'modified'],
|
||||
['label' => '发布时间', 'value' => 'date'],
|
||||
['label' => '评论数', 'value' => 'comments'],
|
||||
['label' => 'WordPress 默认', 'value' => 'default'],
|
||||
], 'help' => '分类/标签/归档页面的默认排序方式'],
|
||||
]],
|
||||
['key' => 'list_option', 'title' => '列表模式配置', 'fields' => [
|
||||
['key' => 'list_list_style', 'label' => '列表样式变体', 'type' => 'radio', 'default' => '', 'options' => [
|
||||
['label' => '默认', 'value' => ''],
|
||||
['label' => '样式2', 'value' => 'style2'],
|
||||
]],
|
||||
['key' => 'list_list_img_position', 'label' => '缩略图位置', 'type' => 'radio', 'default' => 'left', 'options' => [
|
||||
['label' => '左侧', 'value' => 'left'],
|
||||
['label' => '右侧', 'value' => 'right'],
|
||||
]],
|
||||
['key' => 'list_list_scale', 'label' => '缩略图比例 (%)', 'type' => 'number', 'default' => 70, 'min' => 50, 'max' => 200],
|
||||
]],
|
||||
['key' => 'card_option', 'title' => '卡片模式配置', 'fields' => [
|
||||
['key' => 'list_card_style', 'label' => '卡片样式变体', 'type' => 'radio', 'default' => '', 'options' => [
|
||||
['label' => '默认', 'value' => ''],
|
||||
['label' => '样式3', 'value' => 'style3'],
|
||||
]],
|
||||
['key' => 'list_card_scale', 'label' => '缩略图比例 (%)', 'type' => 'number', 'default' => 70, 'min' => 20, 'max' => 200],
|
||||
]],
|
||||
],
|
||||
],
|
||||
'list' => AKSRT_Admin_Schema_Post_List_List::build(),
|
||||
'thumb' => [
|
||||
'key' => 'thumb',
|
||||
'title' => '列表缩略图',
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
<?php
|
||||
/**
|
||||
* Post list — "list" section schema (Zibll-aligned field contract).
|
||||
*
|
||||
* Storage keys mirror Zibll option IDs where the admin list section is the source of truth.
|
||||
* Runtime maps them into render modes; no legacy key fallbacks.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
class AKSRT_Admin_Schema_Post_List_List {
|
||||
|
||||
public static function build(): array {
|
||||
return [
|
||||
'key' => 'list',
|
||||
'title' => '文章列表',
|
||||
'version' => '2.0.0',
|
||||
'option_key' => 'aksrt_settings',
|
||||
'groups' => [
|
||||
[
|
||||
'key' => 'order',
|
||||
'title' => '默认排序与置顶',
|
||||
'fields' => [
|
||||
[
|
||||
'key' => 'list_orderby',
|
||||
'label' => '默认排序方式',
|
||||
'type' => 'radio',
|
||||
'default' => 'modified',
|
||||
'options' => [
|
||||
['label' => '发布时间', 'value' => 'date'],
|
||||
['label' => '更新时间', 'value' => 'modified'],
|
||||
['label' => 'WP默认', 'value' => 'default'],
|
||||
],
|
||||
'help' => '文章列表全局默认排序(对齐 Zibll list_orderby)',
|
||||
],
|
||||
[
|
||||
'key' => 'sticky_s',
|
||||
'label' => '显示置顶文章',
|
||||
'type' => 'checkbox',
|
||||
'default' => ['home', 'cat'],
|
||||
'options' => [
|
||||
['label' => '首页', 'value' => 'home'],
|
||||
['label' => '分类页', 'value' => 'cat'],
|
||||
['label' => '标签页', 'value' => 'tag'],
|
||||
['label' => '专题页', 'value' => 'topics'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'display',
|
||||
'title' => '列表显示',
|
||||
'fields' => [
|
||||
[
|
||||
'key' => 'target_blank',
|
||||
'label' => '新窗口打开文章',
|
||||
'type' => 'switch',
|
||||
'default' => false,
|
||||
],
|
||||
[
|
||||
'key' => 'item_heading_bold',
|
||||
'label' => '列表标题粗体显示',
|
||||
'type' => 'switch',
|
||||
'default' => false,
|
||||
],
|
||||
[
|
||||
'key' => 'post_list_author',
|
||||
'label' => '显示文章作者',
|
||||
'type' => 'switch',
|
||||
'default' => true,
|
||||
],
|
||||
[
|
||||
'key' => 'post_list_time',
|
||||
'label' => '显示文章时间',
|
||||
'type' => 'switch',
|
||||
'default' => true,
|
||||
'help' => '建议作者与时间至少开启一项',
|
||||
],
|
||||
[
|
||||
'key' => 'list_meta_show',
|
||||
'label' => '列表小部件(移动端优先)',
|
||||
'type' => 'radio',
|
||||
'default' => 'like',
|
||||
'options' => [
|
||||
['label' => '阅读量', 'value' => 'view'],
|
||||
['label' => '点赞数', 'value' => 'like'],
|
||||
['label' => '评论', 'value' => 'comm'],
|
||||
],
|
||||
'help' => '移动端空间不足时始终保留的部件',
|
||||
],
|
||||
[
|
||||
'key' => 'list_badge_show',
|
||||
'label' => '列表徽章',
|
||||
'type' => 'checkbox',
|
||||
'default' => ['pay', 'tag', 'topics', 'cat'],
|
||||
'options' => [
|
||||
['label' => '付费', 'value' => 'pay'],
|
||||
['label' => '分类', 'value' => 'cat'],
|
||||
['label' => '专题', 'value' => 'topics'],
|
||||
['label' => '标签', 'value' => 'tag'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'paging',
|
||||
'title' => '列表翻页',
|
||||
'fields' => [
|
||||
[
|
||||
'key' => 'paging_ajax_s',
|
||||
'label' => '列表翻页模式',
|
||||
'type' => 'radio',
|
||||
'default' => '1',
|
||||
'options' => [
|
||||
['label' => 'AJAX 追加列表翻页', 'value' => '1'],
|
||||
['label' => '数字翻页按钮', 'value' => '0'],
|
||||
],
|
||||
'help' => '对齐 Zibll paging_ajax_s;单页数量仍受 WP 阅读设置影响',
|
||||
],
|
||||
[
|
||||
'key' => 'paging_ajax_ias_s',
|
||||
'label' => 'AJAX 自动加载',
|
||||
'type' => 'switch',
|
||||
'default' => true,
|
||||
'dependsOn' => ['key' => 'paging_ajax_s', 'value' => '1'],
|
||||
'help' => '滚动到列表尽头时自动加载下一页(Zibll paging_ajax_ias_s)',
|
||||
],
|
||||
[
|
||||
'key' => 'ias_max',
|
||||
'label' => '自动加载页数',
|
||||
'type' => 'number',
|
||||
'default' => 3,
|
||||
'min' => 0,
|
||||
'max' => 10,
|
||||
'dependsOn' => ['key' => 'paging_ajax_s', 'value' => '1'],
|
||||
'help' => '0 表示不限制,直到加载完全部列表',
|
||||
],
|
||||
[
|
||||
'key' => 'ajax_trigger',
|
||||
'label' => '加载更多文案',
|
||||
'type' => 'input',
|
||||
'default' => '加载更多',
|
||||
'dependsOn' => ['key' => 'paging_ajax_s', 'value' => '1'],
|
||||
],
|
||||
[
|
||||
'key' => 'ajax_nomore',
|
||||
'label' => '没有更多文案',
|
||||
'type' => 'input',
|
||||
'default' => '没有更多了',
|
||||
'dependsOn' => ['key' => 'paging_ajax_s', 'value' => '1'],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'card',
|
||||
'title' => '卡片与布局',
|
||||
'fields' => [
|
||||
[
|
||||
'key' => 'post_card_style',
|
||||
'label' => '列表卡片样式',
|
||||
'type' => 'select',
|
||||
'default' => 'thumb',
|
||||
'options' => [
|
||||
['label' => '标准图文', 'value' => 'thumb'],
|
||||
['label' => '紧凑卡', 'value' => 'compact'],
|
||||
['label' => '大图卡', 'value' => 'large_thumb'],
|
||||
['label' => '多图卡', 'value' => 'multi_thumb'],
|
||||
['label' => '纯文字', 'value' => 'text'],
|
||||
['label' => '有图则图文', 'value' => 'thumb_if_has'],
|
||||
['label' => '卡片模式', 'value' => 'card'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'post_excerpt_length',
|
||||
'label' => '摘要长度',
|
||||
'type' => 'number',
|
||||
'default' => 120,
|
||||
'min' => 20,
|
||||
'max' => 500,
|
||||
],
|
||||
[
|
||||
'key' => 'post_list_per_page',
|
||||
'label' => '每页文章数',
|
||||
'type' => 'number',
|
||||
'default' => 12,
|
||||
'min' => 4,
|
||||
'max' => 48,
|
||||
],
|
||||
[
|
||||
'key' => 'list_show_type',
|
||||
'label' => '列表间距样式',
|
||||
'type' => 'radio',
|
||||
'default' => 'separate',
|
||||
'options' => [
|
||||
['label' => '分隔卡片', 'value' => 'separate'],
|
||||
['label' => '无间距', 'value' => 'no_margin'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'list_list_style',
|
||||
'label' => '列表样式变体',
|
||||
'type' => 'radio',
|
||||
'default' => '',
|
||||
'options' => [
|
||||
['label' => '默认', 'value' => ''],
|
||||
['label' => '样式2', 'value' => 'style2'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'list_list_img_position',
|
||||
'label' => '列表缩略图位置',
|
||||
'type' => 'radio',
|
||||
'default' => 'left',
|
||||
'options' => [
|
||||
['label' => '左侧', 'value' => 'left'],
|
||||
['label' => '右侧', 'value' => 'right'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'list_list_scale',
|
||||
'label' => '列表缩略图比例 (%)',
|
||||
'type' => 'number',
|
||||
'default' => 70,
|
||||
'min' => 50,
|
||||
'max' => 200,
|
||||
],
|
||||
[
|
||||
'key' => 'list_card_style',
|
||||
'label' => '卡片样式变体',
|
||||
'type' => 'radio',
|
||||
'default' => '',
|
||||
'options' => [
|
||||
['label' => '默认', 'value' => ''],
|
||||
['label' => '样式3', 'value' => 'style3'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'list_card_scale',
|
||||
'label' => '卡片缩略图比例 (%)',
|
||||
'type' => 'number',
|
||||
'default' => 70,
|
||||
'min' => 20,
|
||||
'max' => 200,
|
||||
],
|
||||
[
|
||||
'key' => 'list_card_home',
|
||||
'label' => '首页卡片模式',
|
||||
'type' => 'switch',
|
||||
'default' => false,
|
||||
],
|
||||
[
|
||||
'key' => 'list_card_cat',
|
||||
'label' => '分类卡片模式',
|
||||
'type' => 'taxonomy_select',
|
||||
'taxonomy' => 'category',
|
||||
'multiple' => true,
|
||||
'default' => [],
|
||||
],
|
||||
[
|
||||
'key' => 'list_card_tag',
|
||||
'label' => '标签页卡片模式',
|
||||
'type' => 'switch',
|
||||
'default' => false,
|
||||
],
|
||||
[
|
||||
'key' => 'list_card_topics',
|
||||
'label' => '专题页卡片模式',
|
||||
'type' => 'switch',
|
||||
'default' => false,
|
||||
],
|
||||
[
|
||||
'key' => 'list_card_author',
|
||||
'label' => '用户页卡片模式',
|
||||
'type' => 'switch',
|
||||
'default' => false,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user