| | |
| | | } |
| | | |
| | | use JVBase\managers\RoleManager; |
| | | use JVBase\meta\MetaRegistry; |
| | | use JVBase\meta\Registry; |
| | | use JVBase\rest\RegisterRoutes; |
| | | |
| | | class ContentRegistry |
| | |
| | | return; |
| | | } |
| | | |
| | | $meta_registry = new MetaRegistry($fields, $type, $object_type); |
| | | $meta_registry = new Registry($fields, $type, $object_type); |
| | | $meta_registry->registerMetaFields(); |
| | | } |
| | | |
| | |
| | | new OptionsRegistry($fields); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Register REST routes |
| | | */ |
| | | public function registerRestRoutes(): void |
| | | { |
| | | // Register routes for post types |
| | | foreach (JVB_CONTENT as $slug => $config) { |
| | | $this->registerRoute($slug, $config); |
| | | } |
| | | |
| | | // Register routes for content taxonomies |
| | | foreach (JVB_TAXONOMY as $slug => $config) { |
| | | if (jvbCheck('is_content', $config)) { |
| | | $this->registerRoute($slug, $config, 'content_tax'); |
| | | } |
| | | } |
| | | |
| | | // Register routes for options |
| | | if (!empty(JVB_OPTIONS)) { |
| | | $this->registerRoute('options', JVB_OPTIONS['fields'], 'options'); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Register a single route |
| | | */ |
| | | protected function registerRoute(string $slug, array $config, string $type = ''): void |
| | | { |
| | | JVB()->addRoute($slug, new RegisterRoutes($slug, $config)); |
| | | } |
| | | } |
| | | |
| | | new ContentRegistry(); |