Frontend
Lets knowledge base search boxes and the Help widget Ask the Docs.
Search boxes stay normal search forms, so without JavaScript (or without a configured provider) they submit to the knowledge base search results page. The view script enhances them to ask the REST endpoint instead.
Namespace: WebberZone\Knowledge_Base\Pro\AI
Since: 3.2.0
Source: includes/pro/ai/class-frontend.php line 25
Methods
__construct()
Constructor.
Line: 53
public function __construct( AI $ai );
| Type | Name | Description |
|---|---|---|
AI |
$ai |
AI module. |
register_assets()
Register the script and style.
Since: 3.2.0
Line: 66
public function register_assets( ): void;
Returns: void
can_enhance() static
Whether the Ask box can answer questions right now.
Uses only the cached provider status, so rendering never waits on a provider.
Since: 3.2.0
Line: 118
static public function can_enhance( ): bool;
Returns: bool — True if the box should be enhanced.
replace_search_form()
Let the knowledge base search form ask questions.
The search form keeps its markup, styles and live search suggestions; it is wrapped so that submitting asks the question and shows the answer below. When Ask the Docs cannot answer, the search form is left alone.
Since: 3.2.0
Line: 134
public function replace_search_form( $form ): string|null;
| Type | Name | Description |
|---|---|---|
string|null |
$form |
Search form HTML. |
Returns: string|null — Search form HTML.
enqueue_for_help_widget()
Load Ask the Docs for the Help widget.
Since: 3.2.0
Line: 173
public function enqueue_for_help_widget( ): void;
Returns: void
is_kb_search() static
Whether this is the knowledge base search results page.
Since: 3.2.0
Line: 190
static public function is_kb_search( ): bool;
Returns: bool — True on KB search results.