listing_list_action_buttons
Allows adding and removing buttons.
You need to have a working knowledge of Hooks before you get started.
Parameters
| Name | Type | Description |
|---|---|---|
$buttons |
parameter |
(array) action buttons |
$params |
parameter |
(array) associative array with contextual data |
Boilerplate Code
Use the boilerplate code to start using the filter, and add your own logic to modify the first argument and return it.
Clickfwd\Hook\Filter::add('listing_list_action_buttons', function($buttons, $params)
{
// Uncomment line below to view available data passed into hook
// fwd_dd($buttons, $params);
return $buttons;
});
Examples
Add Favorite Button to Listing List Pages
The button will only show in list layouts that offer support for displaying buttons.
Clickfwd\Hook\Filter::add('listing_list_action_buttons', function($buttons, $params)
{
$listing = $params['listing'];
$listingHelper = ClassRegistry::getClass('ListingHelperHelper');
ob_start();
$listingHelper->favorite($listing);
$favoriteButton = ob_get_clean();
$buttons['favorite'] = $favoriteButton;
return $buttons;
}, 10);
Add Send Inquiry Button to Listing List Pages
The button will only show in list layouts that offer support for displaying buttons.
Clickfwd\Hook\Filter::add('listing_list_action_buttons', function($buttons, $params)
{
$listing = $params['listing'];
$listingHelper = ClassRegistry::getClass('ListingHelperHelper');
ob_start();
$listingHelper->inquiry($listing);
$contactButton = ob_get_clean();
$buttons['inquiry'] = $contactButton;
return $buttons;
}, 10);
Source Files
/views/helpers/listing_helper.php