Zoeken en palette hooks
Deze pagina toont de 11 hooks van deze groep. Elke hook laat zijn type zien, de versie waarin hij verscheen, waar hij draait, zijn argumenten en een beginpunt.
adba_commandsadba_customers_urladba_search_content_skipadba_search_customer_urladba_search_filtersadba_search_network_sitesadba_search_page_afteradba_search_page_beforeadba_search_providersadba_search_resultadba_shortcuts
adba_commands
FilterSinds 1.0.0 Draait in src/Modules/Search/Commands.php.
Filtert de palettecommando's.
Een commando is een array met id, label, keywords, url en group. Sinds 2.11.0 kan het ook params hebben (stappen waar de palette om vraagt: name, type order, product, user, choice of text, label, en options voor een choice), endpoint (route onder adba/v1 die de waarden als POST ontvangt, met {name}-plaatshouders, gebruikt in plaats van url), done (tekst van de toast), screens (scherm-id's of bases waar het bovenaan staat) en context (order of product: over het object van dit scherm, de eerste parameter van dat type wordt ingevuld).
| Argument | Type | Beschrijving |
|---|---|---|
$list | array<int, array<string, mixed>> | Commando's. |
add_filter( 'adba_commands', function ( $list ) {
return $list;
} );
adba_customers_url
FilterSinds 1.0.0 Draait in src/Modules/Search/Destinations.php.
De klantenlijst: WooCommerce Klanten als die bestaat, anders de gebruikerslijst.
add_filter( 'adba_customers_url', function ( ) {
return $value;
} );
adba_search_content_skip
FilterSinds 1.3.0 Draait in src/Modules/Search/ContentProvider.php.
Filtert de posttypes die de inhoudszoekopdracht overslaat. Producten en bestellingen hebben hun eigen providers.
| Argument | Type | Beschrijving |
|---|---|---|
$post_types | string[] | Posttype-slugs. |
add_filter( 'adba_search_content_skip', function ( $post_types ) {
return $post_types;
} );
adba_search_customer_url
FilterSinds 1.0.0 Draait in src/Modules/Search/CustomerProvider.php.
Filtert waar een klantzoekresultaat naartoe linkt. Standaard is dat het bewerkscherm van de gebruiker.
| Argument | Type | Beschrijving |
|---|---|---|
$url | string | Linkdoel. |
$user | \WP_User | Gevonden gebruiker. |
add_filter( 'adba_search_customer_url', function ( $url, $user ) {
return $url;
}, 10, 2 );
adba_search_filters
FilterSinds 1.0.0 Draait in src/Modules/Search/SearchService.php.
Filtert de subfilters van de zoekfunctie per providertype.
| Argument | Type | Beschrijving |
|---|---|---|
$all | array | Definities: type => sleutel => {label, options: waarde => label}. |
add_filter( 'adba_search_filters', function ( $all ) {
return $all;
} );
adba_search_network_sites
FilterSinds 2.2.0 Draait in src/Modules/Search/NetworkSearch.php.
Filtert de sites waarop een netwerkzoekopdracht draait (multisite).
Haal sites weg om ze uit de zoekopdracht te houden. Sites die de gebruiker niet kan bereiken, worden nooit toegevoegd, wat deze filter ook teruggeeft.
| Argument | Type | Beschrijving |
|---|---|---|
$site_ids | int[] | Site-id's die de gebruiker kan bereiken. |
$user_id | int | Gebruikers-id. |
add_filter( 'adba_search_network_sites', function ( $site_ids, $user_id ) {
return $site_ids;
}, 10, 2 );
adba_search_page_after
ActionSinds 1.0.0 Draait in templates/search/page.php.
Vuurt aan het einde van de zoekpagina, binnen de wrap. De Help-module print hier de help voor browsers zonder JavaScript.
add_action( 'adba_search_page_after', function ( ) {
// ...
} );
adba_search_page_before
ActionSinds 1.3.0 Draait in templates/search/page.php.
Vuurt bovenaan de zoekpagina, onder de titel en vóór het zoekformulier.
add_action( 'adba_search_page_before', function ( ) {
// ...
} );
adba_search_providers
FilterSinds 1.0.0 Draait in src/Modules/Search/SearchService.php.
Filtert de zoekproviders.
| Argument | Type | Beschrijving |
|---|---|---|
$providers | SearchProviderInterface[] | Providerinstanties, met of zonder sleutel. |
add_filter( 'adba_search_providers', function ( $providers ) {
return $providers;
} );
adba_search_result
FilterSinds 1.3.0 Draait in src/Modules/Search/SearchService.php.
Filtert één zoekresultaat, na de provider en vóór de cache.
Geef het item terug (title, url en de optionele id, subtitle, badge) of false om het te laten vallen. Items zonder titel of url vallen daarna alsnog weg; het type is altijd het provider-id.
| Argument | Type | Beschrijving |
|---|---|---|
$item | array<string, mixed> | Resultaat: id, title, subtitle, url, badge. |
$provider_id | string | Provider-id, bijvoorbeeld orders of content. |
$query | string | Genormaliseerde zoekterm. |
add_filter( 'adba_search_result', function ( $item, $provider_id, $query ) {
return $item;
}, 10, 3 );
adba_shortcuts
FilterSinds 1.0.0 Draait in src/Modules/Search/Shortcuts.php.
Filtert de sneltoetsen.
| Argument | Type | Beschrijving |
|---|---|---|
$list | array<int, array{id: string, keys: string, label: string, url: string, action: string}> | Sneltoetsen. |
add_filter( 'adba_shortcuts', function ( $list ) {
return $list;
} );
Klaar om het te proberen?