feat: rewrite schema-driven widget system
This commit is contained in:
@@ -0,0 +1,309 @@
|
||||
<?php
|
||||
|
||||
namespace AKSRT\WidgetSystem;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
/**
|
||||
* Business field schemas. Rendering behavior is implemented in phase 2.
|
||||
*/
|
||||
final class WidgetSchemas {
|
||||
public static function for(string $slug): array {
|
||||
if (in_array($slug, ['term_cards', 'term_aggregation', 'hot_posts', 'posts', 'tab_posts', 'oneline_posts'], true)) {
|
||||
return self::content($slug);
|
||||
}
|
||||
if ($slug === 'post_pay') {
|
||||
return [
|
||||
['id' => 'theme', 'type' => 'palette', 'label' => '色彩主题', 'default' => 'jb-red', 'options' => CommonFields::palette()],
|
||||
];
|
||||
}
|
||||
if (in_array($slug, ['pricing_plans', 'reviews', 'faq', 'stats', 'highlights', 'feature_intro', 'tilt_cases'], true)) {
|
||||
return self::knowledge_product($slug);
|
||||
}
|
||||
if (in_array($slug, ['slider', 'slider_media_combo'], true)) {
|
||||
return self::slider($slug);
|
||||
}
|
||||
if (in_array($slug, ['user_card', 'author_card', 'user_ranking', 'user_list'], true)) {
|
||||
return self::user($slug);
|
||||
}
|
||||
return self::general($slug);
|
||||
}
|
||||
|
||||
private static function general(string $slug): array {
|
||||
switch ($slug) {
|
||||
case 'search':
|
||||
return [
|
||||
['id' => 'placeholder', 'type' => 'text', 'label' => '提示文字', 'default' => '输入关键词搜索'],
|
||||
['id' => 'search_style', 'type' => 'radio', 'label' => '显示样式', 'default' => 'button', 'options' => ['button' => '按钮式', 'compact' => '紧凑式', 'large' => '大尺寸']],
|
||||
];
|
||||
case 'posts_toc':
|
||||
return [
|
||||
['id' => 'min_headings', 'type' => 'spinner', 'label' => '最少标题数量', 'default' => 3, 'min' => 1, 'max' => 20],
|
||||
['id' => 'collapsed', 'type' => 'switcher', 'label' => '默认收起', 'default' => false],
|
||||
['id' => 'offset', 'type' => 'spinner', 'label' => '滚动偏移', 'default' => 70, 'min' => 0, 'max' => 300],
|
||||
];
|
||||
case 'quote':
|
||||
return [
|
||||
['id' => 'source', 'type' => 'select', 'label' => '内容来源', 'default' => 'local', 'options' => ['local' => '本地句子', 'api' => '在线一言']],
|
||||
['id' => 'quotes', 'type' => 'textarea', 'label' => '本地句子', 'description' => '每行一句', 'default' => "保持好奇,持续创造。\n知识因为分享而更有价值。"],
|
||||
['id' => 'interval', 'type' => 'spinner', 'label' => '自动更新间隔(秒)', 'default' => 30, 'min' => 5, 'max' => 300],
|
||||
];
|
||||
case 'video':
|
||||
return [
|
||||
['id' => 'url', 'type' => 'upload', 'label' => '视频地址', 'default' => ''],
|
||||
['id' => 'poster', 'type' => 'upload', 'label' => '视频封面', 'default' => ''],
|
||||
['id' => 'autoplay', 'type' => 'switcher', 'label' => '自动播放', 'default' => false],
|
||||
['id' => 'muted', 'type' => 'switcher', 'label' => '静音', 'default' => false],
|
||||
['id' => 'ratio', 'type' => 'select', 'label' => '长宽比例', 'default' => '16:9', 'options' => ['16:9' => '16:9', '4:3' => '4:3', '1:1' => '1:1', 'auto' => '自适应']],
|
||||
];
|
||||
case 'embed':
|
||||
return [
|
||||
['id' => 'url', 'type' => 'upload', 'label' => '嵌入地址', 'default' => ''],
|
||||
['id' => 'ratio', 'type' => 'slider', 'label' => '高度比例(%)', 'default' => 56.25, 'min' => 20, 'max' => 200, 'step' => 0.25],
|
||||
['id' => 'allow_fullscreen', 'type' => 'switcher', 'label' => '允许全屏', 'default' => true],
|
||||
];
|
||||
case 'layout_gap':
|
||||
return [
|
||||
['id' => 'pc_gap', 'type' => 'slider', 'label' => 'PC 端间隔', 'default' => 20, 'min' => 0, 'max' => 300],
|
||||
['id' => 'm_gap', 'type' => 'slider', 'label' => '移动端间隔', 'default' => 10, 'min' => 0, 'max' => 200],
|
||||
];
|
||||
case 'tag_cloud':
|
||||
return [
|
||||
['id' => 'taxonomy', 'type' => 'select', 'label' => '分类法', 'default' => 'post_tag', 'options' => ['post_tag' => '标签', 'category' => '分类']],
|
||||
['id' => 'number', 'type' => 'spinner', 'label' => '数量', 'default' => 20, 'min' => 1, 'max' => 100],
|
||||
['id' => 'orderby', 'type' => 'select', 'label' => '排序', 'default' => 'count', 'options' => ['count' => '内容数量', 'name' => '名称', 'term_id' => 'ID', 'rand' => '随机']],
|
||||
['id' => 'show_count', 'type' => 'switcher', 'label' => '显示数量', 'default' => false],
|
||||
];
|
||||
case 'recent_comments':
|
||||
return [
|
||||
['id' => 'count', 'type' => 'spinner', 'label' => '显示数量', 'default' => 6, 'min' => 1, 'max' => 50],
|
||||
['id' => 'exclude_users', 'type' => 'text', 'label' => '排除用户 ID', 'default' => '', 'sanitize' => 'ids'],
|
||||
['id' => 'exclude_posts', 'type' => 'text', 'label' => '排除文章 ID', 'default' => '', 'sanitize' => 'ids'],
|
||||
['id' => 'show_source', 'type' => 'switcher', 'label' => '显示评论来源', 'default' => true],
|
||||
];
|
||||
case 'links':
|
||||
return [
|
||||
['id' => 'style', 'type' => 'button_set', 'label' => '样式', 'default' => 'card', 'options' => ['card' => '卡片', 'bigcard' => '大卡片', 'image' => '图片', 'simple' => '简约']],
|
||||
['id' => 'limit', 'type' => 'spinner', 'label' => '最大数量', 'default' => 12, 'min' => 1, 'max' => 100],
|
||||
['id' => 'links', 'type' => 'group', 'label' => '链接列表', 'max_items' => 100, 'fields' => self::card_fields(true)],
|
||||
];
|
||||
case 'notice':
|
||||
return [
|
||||
['id' => 'interval', 'type' => 'spinner', 'label' => '滚动间隔(秒)', 'default' => 4, 'min' => 1, 'max' => 60],
|
||||
['id' => 'items', 'type' => 'group', 'label' => '公告内容', 'max_items' => 30, 'fields' => self::card_fields(true)],
|
||||
];
|
||||
case 'text_title':
|
||||
return [
|
||||
['id' => 'heading', 'type' => 'textarea', 'label' => '标题', 'default' => ''],
|
||||
['id' => 'description', 'type' => 'textarea', 'label' => '简介', 'default' => ''],
|
||||
['id' => 'alignment', 'type' => 'button_set', 'label' => '对齐', 'default' => 'center', 'options' => ['left' => '左', 'center' => '中', 'right' => '右']],
|
||||
];
|
||||
case 'buttons':
|
||||
return [
|
||||
['id' => 'alignment', 'type' => 'button_set', 'label' => '对齐', 'default' => 'center', 'options' => ['left' => '左', 'center' => '中', 'right' => '右']],
|
||||
['id' => 'gap', 'type' => 'slider', 'label' => '按钮间距', 'default' => 10, 'min' => 0, 'max' => 60],
|
||||
['id' => 'buttons', 'type' => 'group', 'label' => '按钮', 'max_items' => 12, 'fields' => self::button_fields()],
|
||||
];
|
||||
case 'partners':
|
||||
return [
|
||||
['id' => 'rows_pc', 'type' => 'spinner', 'label' => 'PC 行数', 'default' => 2, 'min' => 1, 'max' => 5],
|
||||
['id' => 'rows_mobile', 'type' => 'spinner', 'label' => '移动端行数', 'default' => 1, 'min' => 1, 'max' => 4],
|
||||
['id' => 'speed', 'type' => 'spinner', 'label' => '滚动速度', 'default' => 30, 'min' => 5, 'max' => 120],
|
||||
['id' => 'items', 'type' => 'group', 'label' => '合作伙伴', 'max_items' => 60, 'fields' => self::media_card_fields()],
|
||||
];
|
||||
case 'combo_info':
|
||||
return [['id' => 'items', 'type' => 'group', 'label' => '信息卡片', 'max_items' => 30, 'fields' => array_merge(self::media_card_fields(), [['id' => 'tags', 'type' => 'text', 'label' => '标签', 'default' => '']])]];
|
||||
case 'icon_cards':
|
||||
case 'icon_cover_cards':
|
||||
return [
|
||||
['id' => 'pc_row', 'type' => 'spinner', 'label' => 'PC 单行数量', 'default' => 4, 'min' => 1, 'max' => 12],
|
||||
['id' => 'm_row', 'type' => 'spinner', 'label' => '移动端单行数量', 'default' => 2, 'min' => 1, 'max' => 6],
|
||||
['id' => 'cards', 'type' => 'group', 'label' => '卡片', 'max_items' => 40, 'fields' => self::icon_card_fields()],
|
||||
];
|
||||
case 'media_cards':
|
||||
default:
|
||||
return [['id' => 'cards', 'type' => 'group', 'label' => '卡片', 'max_items' => 40, 'fields' => self::media_card_fields()]];
|
||||
}
|
||||
}
|
||||
|
||||
private static function content(string $slug): array {
|
||||
if ($slug === 'term_cards' || $slug === 'term_aggregation') {
|
||||
return [
|
||||
['id' => 'taxonomy', 'type' => 'select', 'label' => '分类法', 'default' => 'category', 'options' => ['category' => '分类', 'post_tag' => '标签']],
|
||||
['id' => 'term_ids', 'type' => 'text', 'label' => '分类/标签 ID', 'default' => '', 'sanitize' => 'ids'],
|
||||
['id' => 'count', 'type' => 'spinner', 'label' => '数量', 'default' => 8, 'min' => 1, 'max' => 50],
|
||||
['id' => 'pc_row', 'type' => 'spinner', 'label' => 'PC 单行数量', 'default' => 4, 'min' => 1, 'max' => 12],
|
||||
['id' => 'm_row', 'type' => 'spinner', 'label' => '移动端单行数量', 'default' => 2, 'min' => 1, 'max' => 6],
|
||||
];
|
||||
}
|
||||
|
||||
$fields = self::post_query_fields();
|
||||
if ($slug === 'hot_posts') {
|
||||
$fields[] = ['id' => 'show_thumbnail', 'type' => 'switcher', 'label' => '显示缩略图', 'default' => true];
|
||||
}
|
||||
if ($slug === 'oneline_posts') {
|
||||
$fields[] = ['id' => 'autoplay', 'type' => 'switcher', 'label' => '自动滚动', 'default' => true];
|
||||
}
|
||||
if ($slug === 'tab_posts') {
|
||||
$fields[] = [
|
||||
'id' => 'tabs', 'type' => 'group', 'label' => '栏目', 'max_items' => 10,
|
||||
'fields' => [
|
||||
['id' => 'title', 'type' => 'text', 'label' => '栏目标题', 'default' => ''],
|
||||
['id' => 'category_id', 'type' => 'number', 'label' => '分类 ID', 'default' => 0, 'min' => 0],
|
||||
['id' => 'tag_ids', 'type' => 'text', 'label' => '标签 ID', 'default' => '', 'sanitize' => 'ids'],
|
||||
['id' => 'pay_type', 'type' => 'select', 'label' => '付费类型', 'default' => '', 'options' => self::pay_types()],
|
||||
],
|
||||
];
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
private static function post_query_fields(): array {
|
||||
return [
|
||||
['id' => 'category_ids', 'type' => 'text', 'label' => '分类 ID', 'default' => '', 'sanitize' => 'ids'],
|
||||
['id' => 'tag_ids', 'type' => 'text', 'label' => '标签 ID', 'default' => '', 'sanitize' => 'ids'],
|
||||
['id' => 'pay_type', 'type' => 'select', 'label' => '付费内容类型', 'default' => '', 'options' => self::pay_types()],
|
||||
['id' => 'limit_day', 'type' => 'spinner', 'label' => '最近天数', 'default' => 0, 'min' => 0, 'max' => 3650],
|
||||
['id' => 'orderby', 'type' => 'select', 'label' => '排序', 'default' => 'date', 'options' => ['date' => '发布时间', 'modified' => '更新时间', 'views' => '浏览量', 'comments' => '评论数', 'likes' => '点赞数', 'favorites' => '收藏数', 'downloads' => '下载量', 'rand' => '随机']],
|
||||
['id' => 'order', 'type' => 'radio', 'label' => '顺序', 'default' => 'DESC', 'options' => ['DESC' => '降序', 'ASC' => '升序']],
|
||||
['id' => 'count', 'type' => 'spinner', 'label' => '数量', 'default' => 8, 'min' => 1, 'max' => 50],
|
||||
['id' => 'style', 'type' => 'button_set', 'label' => '列表样式', 'default' => 'card', 'options' => ['list' => '列表', 'card' => '卡片', 'mini' => 'Mini']],
|
||||
['id' => 'paginate', 'type' => 'select', 'label' => '翻页方式', 'default' => 'none', 'options' => ['none' => '不翻页', 'numbered' => '数字分页', 'load_more' => '加载更多', 'infinite' => '无限加载']],
|
||||
['id' => 'load_mode', 'type' => 'select', 'label' => '加载方式', 'default' => 'sync', 'options' => ['sync' => '同步', 'ajax' => 'AJAX 延迟加载']],
|
||||
];
|
||||
}
|
||||
|
||||
private static function knowledge_product(string $slug): array {
|
||||
$base = [
|
||||
['id' => 'pc_row', 'type' => 'spinner', 'label' => 'PC 单行数量', 'default' => 3, 'min' => 1, 'max' => 6],
|
||||
['id' => 'm_row', 'type' => 'spinner', 'label' => '移动端单行数量', 'default' => 1, 'min' => 1, 'max' => 3],
|
||||
];
|
||||
if ($slug === 'pricing_plans') {
|
||||
$base[] = ['id' => 'plans', 'type' => 'group', 'label' => '课程/会员方案', 'max_items' => 12, 'fields' => [
|
||||
['id' => 'title', 'type' => 'text', 'label' => '方案名称', 'default' => ''],
|
||||
['id' => 'price', 'type' => 'text', 'label' => '价格', 'default' => ''],
|
||||
['id' => 'description', 'type' => 'textarea', 'label' => '简介', 'default' => ''],
|
||||
['id' => 'features', 'type' => 'textarea', 'label' => '权益(每行一项)', 'default' => ''],
|
||||
['id' => 'cta_type', 'type' => 'select', 'label' => '按钮类型', 'default' => 'link', 'options' => ['link' => '链接', 'post' => '付费文章', 'vip' => '会员方案']],
|
||||
['id' => 'post_id', 'type' => 'number', 'label' => '文章 ID', 'default' => 0, 'min' => 0],
|
||||
['id' => 'vip_level', 'type' => 'number', 'label' => '会员等级', 'default' => 1, 'min' => 1, 'max' => 20],
|
||||
['id' => 'link', 'type' => 'link', 'label' => '按钮链接', 'default' => []],
|
||||
['id' => 'featured', 'type' => 'switcher', 'label' => '推荐方案', 'default' => false],
|
||||
]];
|
||||
return $base;
|
||||
}
|
||||
if ($slug === 'faq') {
|
||||
$base[] = ['id' => 'search', 'type' => 'switcher', 'label' => '显示搜索', 'default' => true];
|
||||
$base[] = ['id' => 'items', 'type' => 'group', 'label' => '问答', 'max_items' => 60, 'fields' => [['id' => 'question', 'type' => 'text', 'label' => '问题', 'default' => ''], ['id' => 'answer', 'type' => 'textarea', 'label' => '回答', 'default' => '', 'allow_html' => true]]];
|
||||
return $base;
|
||||
}
|
||||
$base[] = ['id' => 'items', 'type' => 'group', 'label' => '内容项', 'max_items' => 40, 'fields' => array_merge(self::media_card_fields(), [
|
||||
['id' => 'value', 'type' => 'text', 'label' => '数值/徽标', 'default' => ''],
|
||||
['id' => 'features', 'type' => 'textarea', 'label' => '特性', 'default' => ''],
|
||||
['id' => 'rating', 'type' => 'slider', 'label' => '评分', 'default' => 5, 'min' => 1, 'max' => 5],
|
||||
])];
|
||||
return $base;
|
||||
}
|
||||
|
||||
private static function slider(string $slug): array {
|
||||
$fields = [
|
||||
['id' => 'direction', 'type' => 'radio', 'label' => '方向', 'default' => 'horizontal', 'options' => ['horizontal' => '横向', 'vertical' => '纵向']],
|
||||
['id' => 'effect', 'type' => 'select', 'label' => '切换效果', 'default' => 'slide', 'options' => ['slide' => '滑动', 'fade' => '淡入', 'cube' => '立方体', 'coverflow' => '封面流']],
|
||||
['id' => 'pc_height', 'type' => 'spinner', 'label' => 'PC 高度', 'default' => 400, 'min' => 120, 'max' => 1000],
|
||||
['id' => 'm_height', 'type' => 'spinner', 'label' => '移动端高度', 'default' => 240, 'min' => 100, 'max' => 800],
|
||||
['id' => 'spacebetween', 'type' => 'spinner', 'label' => '间距', 'default' => 15, 'min' => 0, 'max' => 100],
|
||||
['id' => 'speed', 'type' => 'spinner', 'label' => '切换速度(毫秒)', 'default' => 500, 'min' => 100, 'max' => 5000],
|
||||
['id' => 'interval', 'type' => 'spinner', 'label' => '自动播放间隔(秒)', 'default' => 4, 'min' => 1, 'max' => 60],
|
||||
['id' => 'autoplay', 'type' => 'switcher', 'label' => '自动播放', 'default' => true],
|
||||
['id' => 'loop', 'type' => 'switcher', 'label' => '循环', 'default' => true],
|
||||
['id' => 'button', 'type' => 'switcher', 'label' => '显示切换按钮', 'default' => true],
|
||||
['id' => 'pagination', 'type' => 'switcher', 'label' => '显示分页器', 'default' => true],
|
||||
['id' => 'slides', 'type' => 'group', 'label' => '幻灯片', 'max_items' => 30, 'fields' => [
|
||||
['id' => 'background', 'type' => 'upload', 'label' => '背景图片', 'default' => ''],
|
||||
['id' => 'background_video', 'type' => 'upload', 'label' => '背景视频', 'default' => ''],
|
||||
['id' => 'hide_mobile', 'type' => 'switcher', 'label' => '移动端隐藏', 'default' => false],
|
||||
['id' => 'link', 'type' => 'link', 'label' => '链接', 'default' => []],
|
||||
['id' => 'title', 'type' => 'text', 'label' => '标题', 'default' => ''],
|
||||
['id' => 'description', 'type' => 'textarea', 'label' => '说明', 'default' => ''],
|
||||
['id' => 'text_align', 'type' => 'select', 'label' => '文字位置', 'default' => 'left-bottom', 'options' => ['left-top' => '左上', 'left-center' => '左中', 'left-bottom' => '左下', 'center' => '居中', 'right-bottom' => '右下']],
|
||||
['id' => 'layers', 'type' => 'group', 'label' => '图片图层', 'max_items' => 12, 'fields' => [['id' => 'image', 'type' => 'upload', 'label' => '图片', 'default' => ''], ['id' => 'parallax', 'type' => 'spinner', 'label' => '视差', 'default' => 0, 'min' => -300, 'max' => 300], ['id' => 'scale', 'type' => 'slider', 'label' => '缩放', 'default' => 100, 'min' => 10, 'max' => 300]]],
|
||||
]],
|
||||
];
|
||||
if ($slug === 'slider_media_combo') {
|
||||
$fields[] = ['id' => 'side_cards', 'type' => 'group', 'label' => '右侧图文视频卡片', 'max_items' => 6, 'fields' => self::media_card_fields()];
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
private static function user(string $slug): array {
|
||||
if ($slug === 'user_ranking') {
|
||||
return [
|
||||
['id' => 'orderby', 'type' => 'select', 'label' => '榜单类型', 'default' => 'points', 'options' => ['checkin_all_day' => '累计签到', 'checkin_continuous_day' => '连续签到', 'points' => '积分', 'followers' => '粉丝']],
|
||||
['id' => 'number', 'type' => 'spinner', 'label' => '显示数量', 'default' => 8, 'min' => 1, 'max' => 50],
|
||||
['id' => 'show_badge', 'type' => 'switcher', 'label' => '显示前三徽标', 'default' => true],
|
||||
];
|
||||
}
|
||||
if ($slug === 'user_list') {
|
||||
return [
|
||||
['id' => 'number', 'type' => 'spinner', 'label' => '显示数量', 'default' => 12, 'min' => 1, 'max' => 100],
|
||||
['id' => 'include', 'type' => 'text', 'label' => '包含用户 ID', 'default' => '', 'sanitize' => 'ids'],
|
||||
['id' => 'exclude', 'type' => 'text', 'label' => '排除用户 ID', 'default' => '', 'sanitize' => 'ids'],
|
||||
['id' => 'orderby', 'type' => 'select', 'label' => '排序', 'default' => 'registered', 'options' => ['registered' => '注册时间', 'display_name' => '名称', 'post_count' => '文章数', 'points' => '积分', 'followers' => '粉丝']],
|
||||
];
|
||||
}
|
||||
return [
|
||||
['id' => 'show_cover', 'type' => 'switcher', 'label' => '显示封面', 'default' => true],
|
||||
['id' => 'show_posts', 'type' => 'switcher', 'label' => '显示文章', 'default' => $slug === 'author_card'],
|
||||
['id' => 'show_buttons', 'type' => 'switcher', 'label' => '显示快捷按钮', 'default' => true],
|
||||
['id' => 'primary_action', 'type' => 'select', 'label' => '主按钮', 'default' => 'submit', 'options' => self::user_actions()],
|
||||
['id' => 'secondary_action', 'type' => 'select', 'label' => '次按钮', 'default' => 'home', 'options' => self::user_actions()],
|
||||
];
|
||||
}
|
||||
|
||||
private static function icon_card_fields(): array {
|
||||
return [
|
||||
['id' => 'title', 'type' => 'text', 'label' => '标题', 'default' => ''],
|
||||
['id' => 'description', 'type' => 'textarea', 'label' => '说明', 'default' => ''],
|
||||
['id' => 'icon', 'type' => 'icon', 'label' => '图标', 'default' => 'fa fa-star'],
|
||||
['id' => 'custom_icon', 'type' => 'upload', 'label' => '自定义图标', 'default' => ''],
|
||||
['id' => 'color', 'type' => 'palette', 'label' => '颜色', 'default' => 'jb-blue', 'options' => CommonFields::palette()],
|
||||
['id' => 'link', 'type' => 'link', 'label' => '链接', 'default' => []],
|
||||
];
|
||||
}
|
||||
|
||||
private static function media_card_fields(): array {
|
||||
return [
|
||||
['id' => 'title', 'type' => 'text', 'label' => '标题', 'default' => ''],
|
||||
['id' => 'description', 'type' => 'textarea', 'label' => '说明', 'default' => ''],
|
||||
['id' => 'image', 'type' => 'upload', 'label' => '图片', 'default' => ''],
|
||||
['id' => 'image_dark', 'type' => 'upload', 'label' => '深色图片', 'default' => ''],
|
||||
['id' => 'video', 'type' => 'upload', 'label' => '视频', 'default' => ''],
|
||||
['id' => 'link', 'type' => 'link', 'label' => '链接', 'default' => []],
|
||||
];
|
||||
}
|
||||
|
||||
private static function card_fields(bool $link = false): array {
|
||||
$fields = [['id' => 'title', 'type' => 'text', 'label' => '标题', 'default' => ''], ['id' => 'description', 'type' => 'textarea', 'label' => '说明', 'default' => '']];
|
||||
if ($link) {
|
||||
$fields[] = ['id' => 'link', 'type' => 'link', 'label' => '链接', 'default' => []];
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
private static function button_fields(): array {
|
||||
return [
|
||||
['id' => 'text', 'type' => 'text', 'label' => '文字', 'default' => '按钮'],
|
||||
['id' => 'icon', 'type' => 'icon', 'label' => '图标', 'default' => ''],
|
||||
['id' => 'color', 'type' => 'palette', 'label' => '颜色', 'default' => 'jb-blue', 'options' => CommonFields::palette()],
|
||||
['id' => 'link', 'type' => 'link', 'label' => '链接', 'default' => []],
|
||||
];
|
||||
}
|
||||
|
||||
private static function pay_types(): array {
|
||||
return ['' => '全部', 'reading' => '付费阅读', 'download' => '付费下载', 'gallery' => '付费图库', 'video' => '付费视频', 'vip' => 'VIP 专属'];
|
||||
}
|
||||
|
||||
private static function user_actions(): array {
|
||||
return ['home' => '个人主页', 'submit' => '前台投稿', 'vip' => '会员中心', 'orders' => '订单中心', 'recharge' => '余额充值', 'signin' => '签到'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user