Custom element controller does not work properly

Hi there

I am trying to create a custom element for a single page on dashboard. Mainly I am trying to change a little bit header menu of core’s users/search.

So I have created the controller in dashboard/[myPackage]/controllers/element/logs/menu.php like:


namespace Concrete\Package\[MyPackage]\Controller\Element\Logs;

use Concrete\Core\Controller\ElementController;
use Concrete\Core\Entity\Search\Query;
use Concrete\Core\User\Search\SearchProvider;
use Concrete\Core\Form\Service\Form;
use Concrete\Core\Utility\Service\Url;
use Concrete\Core\Validation\CSRF\Token;

class Menu extends ElementController
    protected $query;
    protected $searchProvider;

    public function __construct(SearchProvider $searchProvider)
        $this->searchProvider = $searchProvider;

    public function getElement()
        return 'logs/menu';

    public function setQuery(Query $query): void
        $this->query = $query;

    public function view()
        $itemsPerPage = (isset($this->query)) ? $this->query->getItemsPerPage() : $this->searchProvider->getItemsPerPage();
        $this->set('itemsPerPage', $itemsPerPage);
        $this->set('itemsPerPageOptions', $this->searchProvider->getItemsPerPageOptions());
        $this->set('form', $this->app->make(Form::class));
        $this->set('token', $this->app->make(Token::class));
        $this->set('urlHelper', $this->app->make(Url::class));


And I am calling setQuery function in my single page controller (controllers/single_page/[myPackage]/logs.php) like:

protected function getHeaderMenu()
    if (!isset($this->headerMenu)) {
        $this->headerMenu = $this->app->make(ElementManager::class)->get('logs/menu');

    return $this->headerMenu;

The thing is I am always getting null as return value. Any help would be appreciated

Many thanks in advance

I was missing to pass package handle, so the correct one must have been:

$this->headerMenu = $this->app->make(ElementManager::class)->get('logs/menu', 'my_package_handle');