tasks_collection

Allows adding custom task collections with hashes not supported by the app.

Teamwork

Input (passed by reference)

$params['collection'] object Instance of the tasksCollection class, corresponding to the current task collection, whose public methods should be called to apply custom filtering conditions; e.g., addWhere() and addJoin().
$params['add'] bool Flag requiring to add more collection generation conditions in case of repeated (recursive) call of tasksTasksCollection class methods.
… your plugin code …

Output

$return
true in the case when the current task collection’s hash corresponds to the plugin.
Teamwork

Plugin code example

PHP

public function tasksCollection($params)
{
    /** @var tasksCollection */
    $collection = $params['collection'];

    $hash = $collection->getHash();

    // Check that this plugin's hash is being processed.
    if (strpos(reset($hash), $this->id) !== 0) {
        return null;
    }

    switch (reset($hash)) {
        // URL example using this collection: #/tasks/hash=myplugin_past_year/
        case $this->id . '_past_year':
            // Show tasks created during the past 12 months.
            $collection->addWhere('create_datetime > now() - INTERVAL 12 MONTH');
            return true;
    }
}