backend_tasks

Allows adding custom content to tasks and common navigation blocks (filters) above task lists.

Teamwork

Input (passed by reference)

$params['hash'] string Task list hash.
$params['order'] string Task sorting field from the list: 'priority', 'due', 'newest', 'oldest'.
$params['list']['filters'] string Task filtering parameters.
$params['list']['tasks'] array Task list. Each list item is an instance of the tasksTask class corresponding to each of the tasks in the list.
… your plugin code …

Output

{$backend_tasks.header.top}
Custom content to be added inside the <header> element at the top of the task list.
{$backend_tasks.header.filters}
HTML code of custom <li> elements extending the task filter settings. Custom filter settings elements added by a plugin must be able to add their own parameters to the task list URL, whose values must be processed in the tasks_collection_search hook; e.g., #/tasks/myplugin_create_date>2023-12-25&hash=inbox/.
{$backend_tasks.header.preview}
Custom content to be displayed between the task list and the filter settings.
{$backend_tasks.header.toolbar}
HTML code adding custom task list management tools next to the “Select tasks” checkbox.
{$backend_tasks.header.bottom}
Custom content to be displayed at the bottom of the top block containing the task list title and settings.
{$backend_tasks.header.order_items}
Custom task sorting options. Each list item must be an array with the following keys:
[]['id'] string Sorting option identifier.
[]['name'] string Localized sorting option name.
{$backend_tasks.body.top}
Custom content to be displayed at the top of the task list.
{$backend_tasks.body.bottom}
Custom content to be displayed at the bottom of the task list.
Teamwork

Plugin code example

PHP

public function backendTasks($params)
{
    // $tasks = $params['tasks'];

    return [
        'body' => [
            'top' => 'Custom content at the top',
            'bottom' => 'Custom content at the bottom',
        ],
        'header' => [
            'top' => 'Custom content at the header top',
            'preview' => 'Custom content above the filter settings',
            'toolbar' => sprintf(
                '<a href="javascript:void(0);" class="circle button light-gray" title="%s"><i class="fas fa-star"></i></a>',
                _wp('Execute a custom action')
            ),
            'filters' => tasksMyPluginHelper::getFiltersHTML(),
            'order_items' => [
                [
                    'id' => $this->id . '-custom',
                    'name' => _wp('Custom sorting'),
                ]
            ],
        ],
    ];
}