[ 'label' => 'Help & Support', 'icon' => 'book-open', 'items' => [ [ 'slug' => 'getting-started', 'title' => 'Official Documentation', 'file' => $docs_dir . '/getting-started.md', ], ], ], ]; /** * Filter: woonoow_docs_registry * * Allows addons to register their own documentation. * * @param array $docs Current documentation registry * @return array Modified documentation registry * * @example * add_filter('woonoow_docs_registry', function($docs) { * $docs['my-addon'] = [ * 'label' => 'My Addon', * 'icon' => 'puzzle', * 'items' => [ * [ * 'slug' => 'my-addon/getting-started', * 'title' => 'Getting Started', * 'file' => __DIR__ . '/docs/getting-started.md', * ], * ], * ]; * return $docs; * }); */ return apply_filters('woonoow_docs_registry', $docs); } /** * Get a single documentation item by slug * * @param string $slug Document slug * @return array|null Document data with content, or null if not found */ function get_doc_by_slug($slug) { $registry = get_docs_registry(); foreach ($registry as $section) { foreach ($section['items'] as $item) { if ($item['slug'] === $slug) { // Read file content if (file_exists($item['file'])) { $item['content'] = file_get_contents($item['file']); } else { $item['content'] = '# Document Not Found\n\nThis document is coming soon.'; } return $item; } } } return null; }