VOOZH about

URL: https://deepwiki.com/pcescato/ajc-bridge/5-admin-interface

⇱ Admin Interface | pcescato/ajc-bridge | DeepWiki


Loading...
Menu

Admin Interface

This page covers the structure and initialization of all administrative UI components in AJC Bridge: the menu registration, capability routing, and how Admin, Settings, Columns, and Post_Meta_Box are wired together. It serves as the entry point for understanding what admins and authors see in wp-admin.

  • For the full settings field reference (two-tab structure, GitHub token encryption, field sanitization), see Settings Page.
  • For bulk sync, progress polling, and the Sync History table, see Bulk Operations and Sync History.
  • For the per-post meta box that controls Dev.to publishing, see Post Meta Box.
  • For the Jamstack Sync column in post list tables and row actions, see Admin Columns.

Component Overview

The admin interface is composed of four classes, each with a distinct responsibility:

ClassFileRole
Adminadmin/class-admin.phpMenu registration and capability routing
Settingsadmin/class-settings.phpSettings pages, bulk operations, sync history, AJAX handlers
Columns(see Admin Columns)Custom column in post/page list tables
Post_Meta_Box(see Post Meta Box)Per-post Dev.to publishing checkbox and status display

Admin::init() is the single entry point. It registers the admin_menu hook and delegates to Settings::init() and Columns::init().

Sources: admin/class-admin.php28-34


Initialization Chain

Diagram: Admin subsystem initialization


Sources: admin/class-admin.php28-34 admin/class-settings.php46-55


Menu Structure and Capability Tiers

Admin::add_menu_pages() registers one top-level menu item and three submenus. Access to each page is gated by a WordPress capability.

Diagram: Menu structure and capability gates


Sources: admin/class-admin.php41-83 admin/class-admin.php85-98

Capability Summary

PageSlugMinimum CapabilityRenderer
AJC Bridge (main)ajc-bridgepublish_postsAdmin::render_main_page_router()
Settingsajc-bridge-settingsmanage_optionsSettings::render_settings_page()
Bulk Operationsajc-bridge-bulkmanage_optionsSettings::render_bulk_page()
Sync Historyajc-bridge-historypublish_postsSettings::render_history_page()

The top-level menu entry uses publish_posts so that Authors (editors, contributors) can see the AJC Bridge menu and access Sync History. The router render_main_page_router() then determines which page to actually render based on whether the user has manage_options.

Sources: admin/class-admin.php41-98


AJAX Endpoints

Settings::init() registers five wp_ajax_* hooks. All are admin-only AJAX endpoints (no wp_ajax_nopriv_ equivalents).

Diagram: AJAX action names to handler methods


Sources: admin/class-settings.php50-55 admin/class-settings.php1572-1713

Endpoint Details

Action NameHandlerCapabilityNonce Action
ajc_bridge_test_connectionajax_test_connectionmanage_optionsajc-bridge-test-connection
ajc_bridge_test_devtoajax_test_devto_connectionmanage_optionsajc-bridge-test-connection
ajc_bridge_bulk_syncajax_bulk_syncmanage_optionsatomic-jamstack-bulk-sync
ajc_bridge_get_statsajax_get_statsmanage_optionsatomic-jamstack-get-stats
ajc_bridge_sync_singleajax_sync_singlepublish_postsatomic-jamstack-sync-single

Note that ajc_bridge_sync_single is the only endpoint accessible to non-admin users (Authors with publish_posts).

Sources: admin/class-settings.php1619-1664


Asset Enqueuing

Settings::enqueue_admin_assets() conditionally loads settings.css and settings.js only on plugin pages identified by their hook suffix.

The allowed hooks are:

  • toplevel_page_ajc-bridge
  • ajc-bridge_page_ajc-bridge-settings
  • ajc-bridge_page_ajc-bridge-bulk
  • ajc-bridge_page_ajc-bridge-history

The script is localized as ajcBridgeSettings via wp_localize_script, providing the ajaxurl, five nonce values, and translatable UI strings to the client-side JavaScript.

Sources: admin/class-settings.php63-115


Settings Class Constants

Settings defines two public constants used throughout the plugin to reference option storage and page slugs:

ConstantValueUsed for
Settings::OPTION_NAMEajc_bridge_settingsget_option() / update_option() key
Settings::PAGE_SLUGatomic-jamstack-settingsWordPress Settings API group name
Settings::HISTORY_PAGE_SLUGatomic-jamstack-historyHistory page slug reference

Sources: admin/class-settings.php29-39


Relationship to Other Subsystems

The admin interface connects upward to the plugin bootstrap and outward to the sync pipeline through the AJAX handlers.


Sources: admin/class-admin.php28-34 admin/class-settings.php1572-1713