fix(admin): replicate reference post-feature settings page 1:1

- Rewrite post_list/feature schema (PHP + JS) with the reference theme's
  field set, order, defaults and dependencies; print/PDF toggles dropped
- Move the migrated reference fields off the post-page schema (lightbox
  six switches, post like, default view/like ranges) to kill the dual path
- Map PostDisplay::get_post_page_settings() to the new keys without legacy
  fallback: imagelightbox* (pc_s/m_s checkboxes merged), post_like_s,
  post_default_mate ranges, article_nav + article_nav_mobile_nav_s
- Wire article_nav runtime: content data-nav/no-nav gate with per-post
  override, mobile drawer TOC box, imgbox_type config
- Seed random views/likes on new posts from post_default_mate ranges
- Keep the print stylesheet enqueued unconditionally (no switch); drop the
  dead print/PDF settings and needs_print requirement
- Add post-feature settings reference contract test
This commit is contained in:
2026-09-24 14:29:04 +08:00
parent c331b2aeef
commit 4d6b2c6045
12 changed files with 469 additions and 85 deletions
+5 -3
View File
@@ -41,7 +41,6 @@ trait ScriptsPart1c {
'needs_reward' => false,
'needs_yiyan' => false,
'needs_share' => false,
'needs_print' => false,
];
if (!is_singular()) {
@@ -139,7 +138,6 @@ trait ScriptsPart1c {
$requirements['needs_reward'] = $is_article && !empty($settings['rewards_enabled']);
$requirements['needs_yiyan'] = $has_yiyan;
$requirements['needs_share'] = $is_article && !empty($settings['share_enabled']);
$requirements['needs_print'] = !empty($settings['print_enabled']);
return $requirements;
}
@@ -157,6 +155,10 @@ trait ScriptsPart1c {
? \AKSRT\Settings\Settings::get_post_page_settings()
: [];
$lightbox_on = !isset($post_page_settings['lightbox']) || !empty($post_page_settings['lightbox']);
$lightbox_type = sanitize_key((string) ($post_page_settings['lightbox_type'] ?? 'group'));
if (!in_array($lightbox_type, ['group', 'alone'], true)) {
$lightbox_type = 'group';
}
wp_enqueue_script(
'bootstrap',
$base_uri . '/assets/js/runtime/libs/bootstrap.min.js',
@@ -187,7 +189,7 @@ trait ScriptsPart1c {
? \AKSRT\Settings\PaymentRuntime::get_paid_content_settings()['display']['currency_unit']
: __('元', 'aksrt'),
'imgbox' => $lightbox_on,
'imgbox_type' => 'group',
'imgbox_type' => $lightbox_on ? $lightbox_type : 'group',
'imgbox_thumbs' => $lightbox_on && (!isset($post_page_settings['lightbox_thumbs']) || !empty($post_page_settings['lightbox_thumbs'])),
'imgbox_zoom' => $lightbox_on && (!isset($post_page_settings['lightbox_zoom']) || !empty($post_page_settings['lightbox_zoom'])),
'imgbox_full' => $lightbox_on && (!isset($post_page_settings['lightbox_full']) || !empty($post_page_settings['lightbox_full'])),