fix(admin): replicate reference advanced-filter settings page 1:1
- Rewrite post_list/filter schema (PHP + JS) with the reference theme's
field set, order, defaults and dependencies; topics fields excluded
(no topics taxonomy), AKSRT private filter_* toggles dropped
- Support dynamic checkbox options in AksField (options as formData key)
so cat_custom_filter.custom_filters lists the custom_filter dimensions
- Map PostDisplay filter settings to the new keys without legacy fallback;
cat_custom_filter now carries lists/dropdown fieldsets and array filters
- Wire the archive chain to reference semantics: cat_custom_filter
overrides per-category filter projects, custom_filter_show gates the
default display, dimension chip groups render on category/tag archives
- Filter archive queries (main query + AJAX endpoint) by _aksrt_cf_{key}
meta with exact-quoted LIKE matching
- Add advanced-filter settings reference contract test
This commit is contained in:
1 parent
4d6b2c6045
commit
a8060fa71d
16 files changed
+635
-154
No files matched your search
@@ -129,43 +129,49 @@ class SchemaPostList {
|
||||
'filter' => [
|
||||
'key' => 'filter',
|
||||
'title' => '高级筛选',
|
||||
'version' => '1.0.0',
|
||||
'version' => '2.0.0',
|
||||
'option_key' => 'aksrt_settings',
|
||||
'groups' => [
|
||||
['key' => 'basic', 'title' => '筛选基础', 'fields' => [
|
||||
['key' => 'filter_enabled', 'label' => '启用筛选栏', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'custom_filter_show', 'label' => '筛选显示页面', 'type' => 'checkbox', 'default' => ['cat', 'tag'], 'options' => [
|
||||
['label' => '分类页', 'value' => 'cat'],
|
||||
['label' => '标签页', 'value' => 'tag'],
|
||||
], 'help' => '选择在哪些页面显示筛选栏'],
|
||||
['key' => 'filter_categories', 'label' => '分类筛选', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'filter_tags', 'label' => '标签筛选', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'filter_sort', 'label' => '排序选项', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'filter_ajax_enabled', 'label' => 'AJAX 无刷新筛选', 'type' => 'switch', 'default' => true, 'help' => '启用后分类/标签/排序切换将通过 AJAX 加载,无需刷新页面'],
|
||||
]],
|
||||
['key' => 'ajax_dimensions', 'title' => 'AJAX 筛选维度', 'fields' => [
|
||||
['key' => 'filter_cat_show_cat', 'label' => '分类页:显示分类筛选', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'filter_enabled', 'value' => true]],
|
||||
['key' => 'filter_cat_show_tag', 'label' => '分类页:显示标签筛选', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'filter_enabled', 'value' => true]],
|
||||
['key' => 'filter_tag_show_cat', 'label' => '标签页:显示分类筛选', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'filter_enabled', 'value' => true]],
|
||||
['key' => 'filter_tag_show_tag', 'label' => '标签页:显示标签筛选', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'filter_enabled', 'value' => true]],
|
||||
]],
|
||||
['key' => 'custom_filter', 'title' => '自定义筛选维度', 'fields' => [
|
||||
['key' => 'custom_filter', 'label' => '筛选维度定义', 'type' => 'repeater', 'default' => [], 'dependsOn' => ['key' => 'filter_enabled', 'value' => true], 'help' => '每项定义一个筛选维度(如"类型""地区""年份"),及其可选值列表', 'fields' => [
|
||||
['key' => 'name', 'label' => '维度名称', 'type' => 'input', 'default' => ''],
|
||||
['key' => 'key', 'label' => '维度标识', 'type' => 'input', 'default' => ''],
|
||||
['key' => 'vals', 'label' => '可选值', 'type' => 'repeater', 'default' => [], 'fields' => [
|
||||
['key' => 'key', 'label' => '标识', 'type' => 'input', 'default' => ''],
|
||||
['key' => 'name', 'label' => '显示名', 'type' => 'input', 'default' => ''],
|
||||
['key' => 'advanced_filter', 'title' => '高级筛选', 'fields' => [
|
||||
['key' => 'custom_filter_show', 'label' => '高级筛选默认显示', 'type' => 'checkbox', 'default' => [], 'options' => [
|
||||
['label' => '分类页面显示', 'value' => 'cat'],
|
||||
['label' => '标签页面显示', 'value' => 'tag'],
|
||||
], 'description' => '勾选后将会在对应页面默认显示全部筛选,您可以在下方为单独的分类添加自定义筛选'],
|
||||
['key' => 'custom_filter', 'label' => '自定义高级筛选明细', 'type' => 'repeater', 'default' => [], 'addText' => '添加筛选类别', 'description' => '添加筛选类型及明细', 'fields' => [
|
||||
['key' => 'name', 'label' => '类型名称', 'type' => 'input', 'default' => ''],
|
||||
['key' => 'key', 'label' => '类型key', 'type' => 'input', 'default' => '', 'description' => '必填,只能使用英文加下划线,不能有空格!尽量复杂一点,且配置唯一前缀,以避免与其他mate_key重复,例如(axb_type,axb_year)'],
|
||||
['key' => 'vals', 'label' => '可选择的值', 'type' => 'repeater', 'default' => [], 'addText' => '添加值', 'fields' => [
|
||||
['key' => 'key', 'label' => '值', 'type' => 'input', 'default' => ''],
|
||||
['key' => 'name', 'label' => '显示名称', 'type' => 'input', 'default' => ''],
|
||||
]],
|
||||
]],
|
||||
]],
|
||||
['key' => 'cat_custom_filter', 'title' => '按分类绑定筛选', 'fields' => [
|
||||
['key' => 'cat_custom_filter', 'label' => '分类筛选绑定', 'type' => 'repeater', 'default' => [], 'dependsOn' => ['key' => 'filter_enabled', 'value' => true], 'help' => '为指定分类绑定不同的筛选维度组合', 'fields' => [
|
||||
['key' => 'cats', 'label' => '绑定分类', 'type' => 'taxonomy_select', 'taxonomy' => 'category', 'multiple' => true, 'default' => []],
|
||||
['key' => 'cat_s', 'label' => '显示分类筛选', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'tag_s', 'label' => '显示标签筛选', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'orderby_s', 'label' => '显示排序按钮', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'custom_filters', 'label' => '启用的自定义维度', 'type' => 'input', 'default' => '', 'help' => '逗号分隔维度标识,留空使用全部'],
|
||||
['key' => 'cat_custom_filter', 'label' => '自定义分类的高级筛选', 'type' => 'repeater', 'default' => [], 'addText' => '添加自定义分类筛选', 'description' => '在此处为不同的分类添加不同的筛选项目,实现更加精细化的筛选。同时你也可以在页面显示/分类页面设置分类的默认筛选方式', 'fields' => [
|
||||
['key' => 'cats', 'label' => '绑定分类', 'type' => 'taxonomy_select', 'taxonomy' => 'category', 'multiple' => true, 'default' => [], 'description' => '支持添加多个分类'],
|
||||
['key' => 'cat_s', 'label' => '分类筛选', 'type' => 'switch', 'default' => false, 'description' => '在所选分类页显示的分类筛选列表'],
|
||||
['key' => 'cat_lists', 'label' => ' ', 'type' => 'fieldset', 'default' => ['lists' => [], 'dropdown' => false], 'dependsOn' => ['key' => 'cat_s', 'value' => true], 'fields' => [
|
||||
['key' => 'lists', 'label' => '按钮列表', 'type' => 'async_select', 'source' => 'categories', 'multiple' => true, 'sortable' => true, 'default' => [], 'description' => '选择并排序需要显示的按钮,建议选择同级内容,会自动获取二级三级内容。所选按钮内没有文章则不会显示'],
|
||||
['key' => 'dropdown', 'label' => '下拉列表', 'type' => 'switch', 'default' => false, 'description' => '用下拉框显示更多内容'],
|
||||
]],
|
||||
['key' => 'tag_s', 'label' => '标签筛选', 'type' => 'switch', 'default' => false, 'description' => '在所选分类页显示的标签筛选列表'],
|
||||
['key' => 'tag_lists', 'label' => ' ', 'type' => 'fieldset', 'default' => ['lists' => [], 'dropdown' => false], 'dependsOn' => ['key' => 'tag_s', 'value' => true], 'fields' => [
|
||||
['key' => 'lists', 'label' => '按钮列表', 'type' => 'async_select', 'source' => 'tags', 'multiple' => true, 'sortable' => true, 'default' => [], 'description' => '选择并排序需要显示的按钮'],
|
||||
['key' => 'dropdown', 'label' => '下拉列表', 'type' => 'switch', 'default' => false, 'description' => '用下拉框显示更多内容'],
|
||||
]],
|
||||
['key' => 'orderby_s', 'label' => '排序方式', 'type' => 'switch', 'default' => true, 'description' => '在所选分类页显示排序方式按钮'],
|
||||
['key' => 'orderby_lists', 'label' => ' ', 'type' => 'fieldset', 'default' => ['lists' => ['modified', 'views', 'like', 'comment_count'], 'dropdown' => false], 'dependsOn' => ['key' => 'orderby_s', 'value' => true], 'fields' => [
|
||||
['key' => 'lists', 'label' => '显示排序方式', 'type' => 'select', 'multiple' => true, 'sortable' => true, 'default' => ['modified', 'views', 'like', 'comment_count'], 'options' => [
|
||||
['label' => '更新', 'value' => 'modified'],
|
||||
['label' => '发布', 'value' => 'date'],
|
||||
['label' => '浏览', 'value' => 'views'],
|
||||
['label' => '点赞', 'value' => 'like'],
|
||||
['label' => '评论', 'value' => 'comment_count'],
|
||||
['label' => '收藏', 'value' => 'favorite'],
|
||||
['label' => '随机', 'value' => 'rand'],
|
||||
], 'description' => '选择需要的排序方式按钮'],
|
||||
['key' => 'dropdown', 'label' => '更多排序方式', 'type' => 'switch', 'default' => false, 'description' => '用下拉框显示全部排序方式'],
|
||||
]],
|
||||
// custom_filters 的 options 为运行时动态来源(custom_filter 维度定义),前端按 formData 解析。
|
||||
['key' => 'custom_filters', 'label' => '自定义高级筛选', 'type' => 'checkbox', 'default' => [], 'options' => [], 'description' => '在所选分类页显示的自定义高级筛选项目。如果此处没有选项,或者您修改了上方的文章高级筛选明细,请先保存主题配置并刷新页面后再设置此处'],
|
||||
]],
|
||||
]],
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user