From f4be611c51473359e6d41780f0313c446079e9d3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 09 Jun 2026 15:19:24 +0000
Subject: [PATCH] =Switched the /base/options.php to the same pattern as Site.php: a class based approached rather than a filter. Updated Meta.php to play along with the defined fields from there in Meta::forOptions. Had to change openingHoursSpecificationsTrait.php to not use the translater functions __('text','textdomain') for now, as we load before init.

---
 jvb.php |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/jvb.php b/jvb.php
index e4e4bb7..6cc5ff8 100644
--- a/jvb.php
+++ b/jvb.php
@@ -4,7 +4,7 @@
 Plugin URI: https://jakevan.ca
 Description: The Base Plugin for JakeVan clients
 Author: Jake Vanderwerf
-Version: 1.0.0
+Version: 1.1.0
 Author URI: https://jakevan.ca/
 Textdomain: jvb
 */
@@ -88,6 +88,7 @@
 }, 10, 3);
 
 
+
 function jvbIgnoredPostTypes():array
 {
 	return [BASE.'directory', BASE.'dash', 'attachment', 'revision', 'nav_menu_item'];
@@ -248,11 +249,59 @@
 require(JVB_DIR . '/inc/admin/_setup.php');
 
 require(JVB_DIR . '/JVBase.php');
+
+/**
+ * After moving to the Registrar::based registration, we need to carefully time
+ * 	when Site gets defined, as well as Registrar initial definitions, field definitions,
+ * 	and integration config
+ * These custom actions should simplify the timing for us.
+ */
+add_action('plugins_loaded', 'jvb_site_definitions',1);
+add_action('plugins_loaded', 'jvb_registrar_definitions',2);
+add_action('plugins_loaded', 'jvb_field_definitions', 3);
+add_action('plugins_loaded', 'jvb_options_definitions',3);
 add_action('init', 'jvbLoadBase', 1);
+add_action('init', 'jvb_integration_definitions',3);
+add_action('init', 'jvb_field_section_definitions', 5);
+/**
+ * Can define the Site settings
+ * @return void
+ */
+function jvb_site_definitions():void
+{
+	do_action('jvb_define_site');
+}
+function jvb_registrar_definitions():void
+{
+	do_action('jvb_define_registrar');
+}
+function jvb_field_definitions():void
+{
+	do_action('jvb_define_fields');
+}
+
+function jvb_options_definitions():void
+{
+    do_action('jvb_define_options');
+}
+
 function jvbLoadBase():void
 {
 	JVB::getInstance();
 }
+
+function jvb_integration_definitions():void
+{
+	do_action('jvb_define_integrations');
+}
+
+function jvb_field_section_definitions():void
+{
+	do_action('jvb_define_field_sections');
+	Registrar::maybeBuildSections();
+}
+
+
 function JVB(): JVB
 {
 	return JVB::getInstance();
@@ -317,7 +366,7 @@
 	if (Site::has('favourites')) {
 		$interactions[] = 'favourites';
 	}
-	if (!empty(Registrar::getFeatured('karma'))) {
+	if (!empty(Registrar::withFeature('karma'))) {
 		$interactions[] = 'karma';
 	}
 	if (Site::has('notifications')) {
@@ -325,7 +374,6 @@
 	}
 
 	if (!empty($interactions)) {
-		wp_enqueue_script('jvb-interactions');
 		foreach($interactions as $interaction) {
 			wp_enqueue_script('jvb-'.$interaction);
 		}
@@ -373,7 +421,7 @@
 		}';
 	}
 
-	if (!empty(Registrar::getFeatured('karma'))) {
+	if (!empty(Registrar::withFeature('karma'))) {
 		wp_enqueue_script('jvb-votes');
 		$initUserSettings .= '// Fetch user votes
         try {

--
Gitblit v1.10.0