Triggered during the search used for adding a tag-like link with the # character to the task description or to a comment. Allows modifying the search query text and its results as well as adding search by objects provided by other apps not supported by Teamwork.


Input (passed by reference)

$params['term'] string Text typed by a user after the # character, which is used to search for objects in installed apps.
$params['limit'] int Maximum number of search results that can be shown.
… your plugin code …


The list of search results items. Each list item is an array with the following keys:
[]['app_id'] string Identifier of the app whose object has been found by the search.
[]['entity_type'] string Found object’s type.
[]['entity_title'] string Localized object name.
[]['entity_url'] string Relative URL of the link pointing to the found object.

Plugin code example


public function backendEntityAutocomplete(&$params)
    $term = &$params['term'];
    // Modify the term here if necessary; e.g., correct typos.
    // tasksMyPluginHelper::fixTypo($term);

    // Enable access to Site app's classes.

    // E.g., search for Site app pages by their names.
    $site_pages_model = new sitePageModel();

    $pages = $site_pages_model
        ->select('id, name')
            'name LIKE s:term',
                'term' => sprintf(
                    $site_pages_model->escape($term, 'like')

    if ($pages) {
        $backend_url = wa()->getConfig()->getBackendUrl();

        return array_map(
            function ($page) use ($backend_url) {
                return [
                    'app_id' => 'site',
                    'entity_type' => 'page',
                    'entity_url' => sprintf(
                    'entity_title' => $page['name'],