| | |
| | | <?php |
| | | namespace JVBase\admin; |
| | | |
| | | use JVBase\base\SchemaHelper; |
| | | use JVBase\meta\Form; |
| | | use JVBase\registrar\Registrar; |
| | | use JVBase\ui\Tabs; |
| | |
| | | public function __construct() |
| | | { |
| | | $this->setChecks(); |
| | | add_filter('jvbDashboardPage', [$this, 'addDashboardSection'], 20, 2); |
| | | add_action(BASE.'dashboard_page_seo', [$this, 'addDashboardSection'], 10); |
| | | |
| | | add_action('admin_menu', [$this, 'addAdminMenu']); |
| | | $this->addFormListeners(); |
| | | } |
| | |
| | | ); |
| | | } |
| | | |
| | | public function addDashboardSection(string $content, string $page):string |
| | | public function addDashboardSection():void |
| | | { |
| | | if ($page !== 'jvb-seo') { |
| | | return $content; |
| | | } |
| | | ob_start(); |
| | | $this->renderAdminPage(); |
| | | return ob_get_clean(); |
| | | } |
| | | |
| | | public function renderAdminPage(bool $outputScripts = true):void |
| | |
| | | $this->renderStyles(); |
| | | } |
| | | } |
| | | private function renderStyles(): void |
| | | { |
| | | jvbInlineStyles('forms'); |
| | | } |
| | | |
| | | public function renderProperty(string $property, ?string $value, mixed $class):void |
| | | public function renderProperty(string $property, mixed $value, mixed $class):void |
| | | { |
| | | $method = 'get'.ucFirst($property).'FieldConfig'; |
| | | $config = method_exists($class, $method) ? $class->$method() : $this->buildConfig($property); |
| | |
| | | $this->formStart('website'); |
| | | $default = 'JVBase\managers\SEO\render\Thing\CreativeWork\WebSite'; |
| | | // $this->renderSchemaTypeSelection($value); |
| | | $stored = get_option(BASE.'WebsiteSchema',apply_filters(BASE.'websiteSchema', [])); |
| | | $stored = SchemaHelper::schema('website'); |
| | | |
| | | $this->renderFieldsFor($default, $stored); |
| | | $this->formEnd(); |
| | | return ob_get_clean(); |
| | |
| | | $default = apply_filters(BASE.'OrganizationSchemaType', 'JVBase\managers\SEO\render\Thing\Organization\Organization'); |
| | | $value = get_option(BASE.'OrganizationSchemaType', $default); |
| | | $this->renderSchemaTypeSelection($value); |
| | | $stored = get_option(BASE.'OrganizationSchema',apply_filters(BASE.'OrganizationSchema', [])); |
| | | |
| | | $stored = SchemaHelper::schema('organization'); |
| | | $this->renderFieldsFor($value, $stored); |
| | | $this->formEnd(); |
| | | return ob_get_clean(); |