kanban_page
Allows adding custom task filtering elements to the Kanban section.
Teamwork
Input (passed by reference)
No specific parameters.
… your plugin code …
Output
{$kanban_page.$output}
Nested array with the
['header']['filters'] key, containing the HTML code of custom elements to be added at the top of the Kanban section, allowing users to filter tasks.Teamwork
Plugin code example
PHP
public function kanbanPage()
{
$filter_name = $this->id . '-plugin-filter';
return [
'header' => [
'filters' => waHtmlControl::getControl(waHtmlControl::CHECKBOX, $filter_name, [
'title' => _wp('My filter'),
'value' => '1',
'checked' => false,
'title_wrapper' => '%s',
'control_wrapper' => '
<div class="t-checkbox-column">
<span class="wa-checkbox">
%2$s
<span>
<span class="icon">
<i class="fas fa-check"></i>
</span>
</span>
</span>
<span class="custom-ml-4">%1$s%3$s</span>
</div>
'
. <<<HTML
<script>
$(document).on('click', '.t-header-wrapper :checkbox[name="{$filter_name}"]', function (e) {
const checkbox = $(this);
const params = checkbox.is(':checked') ? 'plugins/{$filter_name}/...' : '';
window.location.hash = '#/kanban/' + params + (params ? '/' : '');
// additional code must be written
// to load a filtered kanban task listing
// when this custom URL is used
});
</script>
HTML,
]),
],
];
}









