JReviews logo Docs
Menu
Version

jreviews:admin_route_matched:{:name}

Route-specific action that fires when a JReviews admin route is matched. The route name has dots converted to underscores (e.g., 'listings.index' becomes 'listings_index'). Useful for conditionally loading admin assets or performing actions based on the current admin route.

Action
Asset Manager
Since 6.0.0
Generic Version Available
This hook has a generic version jreviews:admin_route_matched that fires for all variations. Both hooks receive the same parameters. The generic version fires before the specific variation hooks, allowing you to apply logic across all variations or target specific ones.

You need to have a working knowledge of Hooks before you get started.

Fires after route matching on admin requests, before the controller executes

Parameters

Name Type Description
$route string The original route name (with dots, e.g., 'listings.index')
$parameters array Route parameters extracted from the URL
$request \FWD\Illuminate\Http\Request The current HTTP request object

Variations

This dynamic hook fires for each of the following variations. The {:name} placeholder in the hook name is replaced with one of these values:

comments_index
fields_index
listings_index
settings_configuration

For example, to target the comments_index variation, you would use:

fwd_add_action('jreviews:admin_route_matched:comments_index', function($route, $parameters, $request)
{
    // Your code here
}, 20, 3);

Boilerplate Code

Use the boilerplate code to start using the action, and add your own logic or echo output.

fwd_add_action('jreviews:admin_route_matched:{:name}', function($route, $parameters, $request)
{
    // Execute action or echo output
}, 20, 3);

The , 20, N after your callback are the hook priority and the number of arguments your callback accepts. By default, a hook passes your callback only its first argument; for a filter, that is the value being filtered, so a simple function($value) { ... } needs nothing extra. If your callback declares more parameters, such as function($value, $listing) { ... }, you must add N (the parameter count, 2 here). Because N is the fourth argument to fwd_add_filter() or fwd_add_action(), you must also pass the priority (20 is the default). Leaving these off when your callback expects extra parameters causes a Too few arguments to function ... fatal error.

Development & Support
Customizations are not included with support. We provide this information to make it easier for developers to extend the functionality. From time to time we may have some availability for custom work. Get in touch to see if there's an opportunity to work together.

Source Files

  • app/Providers/AssetLoaderServiceProvider.php