Unwanted list heading buttons when Hide checkbox selected

Status
Not open for further replies.
I have a number of lists in which I need to prevent multi-row deletion and also multi-row plugin operations. This is easily done by selecting “Hide checkbox” in the Details:Links section of the form design. Unfortunately, the delete and other plugin buttons still appear in the list heading; clicking one produces an error dialog, stating that a row must be selected – which is of course not possible.

As I could not think of any reason for the buttons to appear when the checkboxes are hidden, I decided to look and see if I could find a means of removing them. Had I realised how complicated the code is I would probably not have started, but having done so, did not want to give up. After several failures, I found code in the function actionHeading() in list.php where a small modification seemed to do the trick.

At line 7316, the code is:
PHP:
if (empty($headingButtons))
{
    $aTableHeadings['fabrik_actions'] = '';
}
else
{
    if ($this->actionMethod() == 'dropdown')
    {
        $align = $params->get('checkboxLocation', 'end') == 'end' ? 'right' : 'left';
        $aTableHeadings['fabrik_actions'] = FabrikHelperHTML::bootStrapDropDown($headingButtons, $align);
    }
    else
    {
        $aTableHeadings['fabrik_actions'] = FabrikHelperHTML::bootStrapButtonGroup($headingButtons);
    }
}
This creates a <th> section in the HTML, either containing the buttons or empty if there are none.

I modified the initial test, based on the code that hides the checkbox in function addCheckBox(), replacing:
PHP:
if (empty($headingButtons))
with:
PHP:
$hidecheckbox = $params->get('hidecheckbox', '0');
if (empty($headingButtons) || $hidecheckbox == '1' || !$this->canSelectRows())
As far as I can tell, this has no unfortunate side effects, but the code is very complex so I would appreciate the opinions of those with greater knowledge of Fabrik.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top