assertRouteAccess(); } public function indexAction() { $this->addTitleTab(t('User Groups')); $db = $this->getDb(); $usergroups = Usergroup::on($db); $this->handleSearchRequest($usergroups); $limitControl = $this->createLimitControl(); $paginationControl = $this->createPaginationControl($usergroups); $sortControl = $this->createSortControl( $usergroups, [ 'usergroup.display_name' => t('Name') ] ); $searchBar = $this->createSearchBar($usergroups, [ $limitControl->getLimitParam(), $sortControl->getSortParam() ]); if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) { if ($searchBar->hasBeenSubmitted()) { $filter = $this->getFilter(); } else { $this->addControl($searchBar); $this->sendMultipartUpdate(); return; } } else { $filter = $searchBar->getFilter(); } $this->filter($usergroups, $filter); yield $this->export($usergroups); $this->addControl($paginationControl); $this->addControl($sortControl); $this->addControl($limitControl); $this->addControl($searchBar); $this->addContent(new UsergroupList($usergroups)); if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) { $this->sendMultipartUpdate(); } $this->setAutorefreshInterval(10); } public function completeAction() { $suggestions = new ObjectSuggestions(); $suggestions->setModel(Usergroup::class); $suggestions->forRequest(ServerRequest::fromGlobals()); $this->getDocument()->add($suggestions); } public function searchEditorAction() { $editor = $this->createSearchEditor(Usergroup::on($this->getDb()), [ LimitControl::DEFAULT_LIMIT_PARAM, SortControl::DEFAULT_SORT_PARAM, ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM ]); $this->getDocument()->add($editor); $this->setTitle(t('Adjust Filter')); } }