Custom button in List Contoller

It’s possible create a custom button in List Controller (like as Create or Delete buttons) so that when clicked it shows or hides deleted records (deleted_at ‘equal to’ or ‘different’ from NULL). If so, how would it be done?

I ask this question because I created a plugin with Builder and I need it to eventually be able to access records in the trash.

Thanks in advance for any help!

You can add a button in a list controller in the files inside your controller directory (ex: author/plugins/controllers/yourcontrollername

For your case, a filter (checkbox) would be more appropriate. Filtering Records - October CMS - 3.x

1 Like

You can install this plugin:

and take a look how it’s done

1 Like

How to get the ID value within a custom function in the controller?

In _list_toolbar I created a button called Restore Selected (onRecover):

However, in the onRecover function within the Controller, the record is not being transported, returning NULL
20240422122928

I don’t know where I’m going wrong. $recordId is empty :roll_eyes:

data-list-checked-trigger always return array of checked ids from listController

public function onRecover(){
$records = post('checked');
...your logic here...
}
2 Likes