private static function getTagSearchObjectForUser($user, $term) { $tag_entry = Logbook::getSearchObjectForUser($user); $tag = $tag_entry->also('BlogTag'); $tag->clauseSafe('tag_name', $term); if (Logbook::current()->shouldExcludeTitleFromTagSearch()) { $title_term = '%' . str_replace(' ', '%', $term) . '%'; $entry->clause('entry_title', $title_term, Clause::NOT_LIKE); } return $tag_entry; }