JReviews logo Docs
Menu
Version

jreviews:listing:badges.{:name}

Filters the status badges for a specific display context (detail, list, or card view).

Filter
Listing Detail
Since 6.0.0
Generic Version Available
This hook has a generic version jreviews:listing:badges 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 the generic badges hook, allows context-specific customization

Parameters

Name Type Description
$filterResult array Same structure as jreviews:listing:badges
$listing \JReviews\App\Models\Listing The listing being displayed

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:

- `jreviews:listing:badges.detail` - Fires in detail view - `jreviews:listing:badges.list` - Fires in list view - `jreviews:listing:badges.card` - Fires in card view

For example, to target the - `jreviews:listing:badges.detail` - Fires in detail view - `jreviews:listing:badges.list` - Fires in list view - `jreviews:listing:badges.card` - Fires in card view variation, you would use:

fwd_add_filter('jreviews:listing:badges.- `jreviews:listing:badges.detail` - Fires in detail view - `jreviews:listing:badges.list` - Fires in list view - `jreviews:listing:badges.card` - Fires in card view', function($filterResult, $listing)
{
    // Your code here
    
    return $filterResult;
}, 20, 2);

Boilerplate Code

Use the boilerplate code to start using the filter, and add your own logic to modify the first argument and return it.

fwd_add_filter('jreviews:listing:badges.{:name}', function($filterResult, $listing)
{
    // Your code here
    
    return $filterResult;
}, 20, 2);

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

  • resources/views/site/components/listing/badges.blade.php