1. Admin / WordPress Hooks Registered in init()
These hooks connect the contact module with the NextCRM admin menu, enqueue system, AJAX system, activation process, and WordPress user deletion.
| Hook | Type | Code Ref | Purpose |
|---|---|---|---|
nextcrm/admin_menu/bottom | Action | Line 19 | Registers Contact, Add New, Lists, Tags, and Contact Settings menus. |
nextcrm/enqueue/admin/page/dependency | Filter | Line 21 | Adds contact post type pages to the admin enqueue dependency list. |
nextcrm/admin/notices/dependency | Filter | Line 27 | Adds contact post type to the admin notices dependency list. |
nextcrm/admin/enqueue/middle | Action | Line 33 | Enqueues contact page assets like Choices, Flatpickr, and nextcrm-contact. |
nextcrm/enqueue/admin/dependency | Filter | Line 72 | Adds nextcrm-contact script as an admin dependency. |
nextcrm/admin_menu/bottom
Registers the Contact module submenus inside the NextCRM admin menu.
Code Reference
add_action('nextcrm/admin_menu/bottom', [$this, 'register_menus']);
Callback
public function register_menus( $menulist ) {
// Add Contacts, Add New, Lists, Tags, Contact Settings menus
}
Use Case
This hook is used internally to attach the Contact menu to the NextCRM dashboard.
nextcrm/enqueue/admin/page/dependency
Adds contact-related pages to the list of pages where admin assets should load.
Code Reference
add_filter('nextcrm/enqueue/admin/page/dependency', function( $pages = []){
$pages[] = 'edit-' . nextcrm_manager()->contact->get_posttype();
$pages[] = nextcrm_manager()->contact->get_posttype();
return $pages;
});
Example
add_filter('nextcrm/enqueue/admin/page/dependency', function($pages) {
$pages[] = 'my-custom-contact-page';
return $pages;
});
nextcrm/admin/notices/dependency
Controls where NextCRM admin notices should be hidden or handled.
Code Reference
add_filter('nextcrm/admin/notices/dependency', function( $items = []){
$items[] = nextcrm_manager()->contact->get_posttype();
return $items;
});
Example
add_filter('nextcrm/admin/notices/dependency', function($items) {
$items[] = 'ncrm_contact';
return $items;
});
nextcrm/admin/enqueue/middle
Loads the contact page CSS and JS files.
Code Reference
add_action('nextcrm/admin/enqueue/middle', function(){
wp_enqueue_style('choices', nextcrm_core()->vendor . 'choices/choices.min.css');
wp_enqueue_script('choices', nextcrm_core()->vendor . 'choices/choices.min.js');
});
nextcrm/enqueue/admin/dependency
Adds nextcrm-contact as a dependency in the NextCRM admin enqueue system.
Code Reference
add_filter('nextcrm/enqueue/admin/dependency', function( $dep ){
$dep[] = 'nextcrm-contact';
return $dep;
});
Example
add_filter('nextcrm/enqueue/admin/dependency', function($dep) {
$dep[] = 'my-custom-contact-script';
return $dep;
});