Filter the merged list of integrations used to render the integrations grid (metadata + instance per slug).
The manager builds a single list for the UI by merging metadata (label, description, logo, category, url) with the registered instance (if any) for each slug. This filter receives that merged array so you can reorder, add, or remove entries before they are output as cards. Each item is array( 'metadata' => array(...), 'instance' => WPDAI_Integration_Base|null ).
File: includes/integrations/WPDAI_Integrations_Manager.php
Method: get_all_integrations_for_display()
| Parameter | Type | Description |
|---|---|---|
| $merged | array | Associative array slug => array( 'metadata' => array, 'instance' => WPDAI_Integration_Base|null ) |
Type: array
The (possibly modified) merged array.
add_filter( 'wpd_ai_all_integrations_for_display', 'sort_integrations_by_label' );
function sort_integrations_by_label( $merged ) {
uasort( $merged, function( $a, $b ) {
$la = isset( $a['metadata']['label'] ) ? $a['metadata']['label'] : '';
$lb = isset( $b['metadata']['label'] ) ? $b['metadata']['label'] : '';
return strcasecmp( $la, $lb );
} );
return $merged;
}
add_filter( 'wpd_ai_all_integrations_for_display', 'hide_pro_integrations_for_editor' );
function hide_pro_integrations_for_editor( $merged ) {
if ( current_user_can( 'editor' ) ) {
foreach ( $merged as $slug => $data ) {
if ( ! empty( $data['metadata']['is_pro'] ) ) {
unset( $merged[ $slug ] );
}
}
}
return $merged;
}