getSlug() . '-' . $tab->getSlug(); } /** @internal */ public function wpAddMenu(): void { add_options_page($this->getTitle(), $this->getTitle(), 'manage_options', $this->getSlug(), (new PageLayoutComponent($this))); } /** @internal */ public function wpAddFields(): void { foreach ($this->getTabs() as $tab) { $this->registerTab($tab); } } protected function registerTab(Tab $tab): void { $fields = array_filter($tab->getBlocks(), function ($block) { return $block instanceof Field; }); foreach ($fields as $field) { $this->registerField($field, $tab); } } protected function registerField(Field $field, Tab $tab): void { register_setting( $this->getOptionGroup($tab), $field->getKey(), [ 'type' => $field->getValueType(), 'sanitize_callback' => $field->getValueSanitizer(), ] ); } }