Hooks

Hooks: Pro Integration Bridge

5 min read

Notifal Pro extends the base plugin through a bridge layer: Pro-specific hook constants, and callbacks on base notifal/* filters (display rules, analytics, smart targeting, comment content source).

Requires Notifal Pro installed and active. Boot after both plugins are ready:

add_action( 'notifal_pro/initialized', function () {
    // Pro modules are available.
} );

Index: Hook Reference Hub. Base boot order: Getting Started for Developers.

Pro bootstrap (action)

HookParametersDescription
notifal_pro/initializednonePro plugin fully initialized; all Pro services registered

Constant: NotifalPro\Infrastructure\WordPress\Hooks\ActionHooks::PRO_PLUGIN_INIT.

Base plugin must fire notifal/initialized first; Pro listens on that hook in notifal-pro/app/Bootstrap/Plugin.php.

Pro infrastructure (FilterHooks.php)

ConstantHookParametersDescription
INFRASTRUCTURE_SERVICESnotifal_pro/infrastructure/servicesstring[] $servicesPro global infrastructure service classes

Pro actions (ActionHooks.php)

ConstantHookParametersDescription
PRO_PLUGIN_INITnotifal_pro/initializednonePro ready (see above)
REGISTER_COMMENT_TAGSnotifal_pro/comment_tags/register$managerRegister Pro comment tags
COMMENT_TAGS_REGISTEREDnotifal_pro/comment_tags/registered$managerAfter comment tags registered
PRO_FRONTEND_ASSETS_BEFORE_ENQUEUEnotifal_pro/frontend_assets/before_enqueuenoneBefore Pro frontend assets
PRO_FRONTEND_ASSETS_AFTER_ENQUEUEnotifal_pro/frontend_assets/after_enqueuenoneAfter Pro frontend assets
BEFORE_UPDATE_DOWNLOADnotifal_pro/update/before_source_selectionstring $source, array $hook_extraBefore upgrader source selection
AFTER_UPDATE_DOWNLOADnotifal_pro/update/after_source_selectionstring $source, array $hook_extraAfter upgrader validates source

Comment content source bridge (Pro module)

Registered by CommentIntegrationService when Pro comment features are available. Base plugin invokes these with empty defaults when Pro is inactive. See also Display Rules and Content Source.

FilterParametersDescription
notifal_pro_build_comment_filtersarray $filters, array $settingsComment query filters
notifal_pro_fetch_comment_poolarray $pool, array $filters, array $settingsComment pool rows
notifal_pro_get_comment_count`intnull $count, array $settings, array $filters`Comment counter tag value
notifal_pro_build_comment_based_contextarray $settings, array $pageContextTag context for comment source
notifal_pro_add_comment_context_to_post_basedarray $context, ...Comment context on post-based source
notifal_pro_add_comment_context_to_page_basedarray $context, ...Comment context on page-based source
notifal_pro_add_comment_context_to_mixedarray $context, ...Comment context on mixed source
notifal_pro_add_comment_context_to_{entityType}dynamic suffixEntity-specific comment context
notifal_pro_get_hidden_comment_restrictionsarray $detectedCategoriesRestrictions hidden in tag category UI

Base hooks Pro commonly implements

Pro modules attach to base notifal/* filters (constants in base FilterHooks.php):

Base filterPro usage
notifal/onpage/display_rules/supported_typesAdds category, URL, user rule types
notifal/onpage/display_rules/before_validationStrips or validates Pro rule data
notifal/onpage/display_rules/evaluation_resultAdvanced rule evaluation
notifal/onpage/smart_targeting_ui_visibleHide UI when template has only page tags
notifal/onpage/content_source/sanitized_settingsSmart targeting settings sanitization
notifal/onpage/content_source/entity_filtersSmart targeting entity filters
notifal/onpage/content_source/resolve_poolMulti-phase pool loading
notifal/onpage/content_source/pool_cache_keyPage-context cache keys
notifal/onpage/frontend/contextSmart targeting frontend context
notifal/onpage/is_pro_analytics_activeWhether Pro analytics integration is active
notifal/onpage/get_pro_analytics_serviceReturns Pro analytics service when available
notifal/onpage/analytics/ calculate_CTR, conversion, close rate calculations
notifal/onpage/appearance/display_type_optionsAdds Inline display type when Pro is active
notifal/onpage/appearance/sanitized_settingsInline placement mode, placement id, custom hook fields
notifal/onpage/eligibility/global_eligibleExcludes inline notifications from global floating injection
notifal/onpage/frontend/immediate_preload_notificationsPreloads inline payloads for mount containers
notifal/admin/list/custom_columnInline shortcode copy icon in Display Type column

User guide: Inline On-Page Notifications (Pro). Developer notes: notifal-pro/app/Modules/OnPageNotification/INLINE.md.

Helper functions

FunctionDescription
notifal_pro_app( ClassName::class )Resolve Pro DI container service

Defined in notifal-pro/app/Core/helpers.php.

Source file map

AreaPath
Pro hook constantsnotifal-pro/app/Infrastructure/WordPress/Hooks/ActionHooks.php, FilterHooks.php
Base hook constantsnotifal/app/Infrastructure/WordPress/Hooks/ActionHooks.php, FilterHooks.php
Analytics bridgenotifal-pro/app/Modules/OnPageNotification/Infrastructure/WordPress/ProAnalyticsIntegration.php
Display rulesnotifal-pro/app/Modules/OnPageNotification/Application/Services/ProDisplayRulesIntegrationService.php
Comment bridgenotifal-pro/app/Modules/OnPageNotification/Application/Services/CommentIntegrationService.php
Inline deliverynotifal-pro/app/Modules/OnPageNotification/Application/Services/Inline/

Hooks series

  1. Hook Reference Hub
  2. Hooks: Lifecycle and Bootstrap
  3. Hooks: Notifications and Eligibility
  4. Hooks: Templates and Rendering
  5. Hooks: Tags and Dynamic Data
  6. Hooks: Display Rules and Content Source
  7. Hooks: Analytics and Tracking
  8. Hooks: Admin UI Extension
  9. Hooks: Pro Integration Bridge (you are here)