tabset hook doesn't work for action links on Manage Contribution Pages
Description
According to the hook_civicrm_tabset docs, we should be able to insert an action link on the Manage Contribution page (the one that lists all existing contribution pages). However, when I add the recommended code, it breaks the display of the action links by hiding the first four links, so it looks like this:
Replicate
To replicate the problem:
- Create at least one contribution page
- Create a new extension called "test". Add the following to test.php:
function test_civicrm_tabset($tabsetName, &$tabs, $context) {
//check if the tabset is Contribution Page
if ($tabsetName == 'civicrm/admin/contribute') {
if (!empty($context['contribution_page_id'])) {
$contribID = $context['contribution_page_id'];
$url = CRM_Utils_System::url( 'civicrm/admin/contribute/newtab',
"reset=1&snippet=5&force=1&id=$contribID&action=update&component=contribution" );
//add a new Volunteer tab along with url
$tab['newTab'] = array(
'title' => ts('newTab'),
'link' => $url,
'valid' => 1,
'active' => 1,
'current' => false,
);
}
if (!empty($context['urlString']) && !empty($context['urlParams'])) {
$tab[] = array(
'title' => ts('newTab'),
'name' => ts('newTab'),
'url' => $context['urlString'] . 'newtab',
'qs' => $context['urlParams'],
'uniqueName' => 'newtab',
);
}
//Insert this tab into position 4
$tabs = array_merge(
array_slice($tabs, 0, 4),
$tab,
array_slice($tabs, 4)
);
}
}
Environment:
- CiviCRM: master (6.2.alpha1 - commit 1d632f43)
- CMS: Drupal 10
- PHP: 8.2 (fpm)
- Database: MariaDB 10.11.11
- Webserver: Nginx
- Linux