| | |
| | | |
| | | use JVBase\managers\AdminPages; |
| | | use JVBase\meta\Form; |
| | | use JVBase\registrar\Registrar; |
| | | use JVBase\ui\Tabs; |
| | | |
| | | if (!defined('ABSPATH')) { |
| | |
| | | */ |
| | | class SEOAdminPage |
| | | { |
| | | private ConfigManager $config; |
| | | private SchemaBuilder $registry; |
| | | // private SchemaBuilder $registry; |
| | | |
| | | public function __construct() |
| | | { |
| | | $this->registry = SchemaBuilder::getInstance(); |
| | | // $this->registry = SchemaBuilder::getInstance(); |
| | | |
| | | |
| | | // Add to JVB dashboard |
| | | add_action(BASE.'dashboardPage', [$this, 'addDashboardSection'], 10, 1); |
| | | add_filter('jvbDashboardPage', [$this, 'addDashboardSection'], 20, 2); |
| | | add_action('admin_enqueue_scripts', [$this, 'enqueueScripts']); |
| | | } |
| | |
| | | /** |
| | | * Add section to JVB dashboard |
| | | */ |
| | | public function addDashboardSection(string $content, string $page): string |
| | | public function addDashboardSection(string $page):void |
| | | { |
| | | if ($page !== 'SEO') { |
| | | return $content; |
| | | jvbDump($page); |
| | | if ($page !== 'seo') { |
| | | return; |
| | | } |
| | | ob_start(); |
| | | $this->renderAdminPage(); |
| | | return ob_get_clean(); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | $types = ['meta', 'schema']; |
| | | |
| | | switch ($type) { |
| | | case 'content': |
| | | $config = JVB_CONTENT; |
| | | $types[] = 'archive'; |
| | | break; |
| | | case 'taxonomy': |
| | | case 'taxonomies': |
| | | $config = JVB_TAXONOMY; |
| | | break; |
| | | case 'user': |
| | | $config = JVB_USER; |
| | | break; |
| | | default: |
| | | error_log('[SEOAdminPage]:renderConfig --- no config found for '.$type); |
| | | return ''; |
| | | if ($type == 'content') { |
| | | $types[] = 'archive'; |
| | | } |
| | | |
| | | $registrar = Registrar::getInstance($type); |
| | | if (!$registrar){ |
| | | return ''; |
| | | } |
| | | $config = $registrar->getConfig('seo'); |
| | | |
| | | $mainTabs = new Tabs(); |
| | | |
| | | foreach ($config as $c => $opt) { |