src/Event/Model/WidgetsListener.php
private function getAppWidgets(): array
    {
        $table = TableRegistry::get('Search.AppWidgets');

        $query = $table->find('all')
            ->select(['id', 'name', 'content']);

        if ($query->isEmpty()) {
            return [];
        }

        $data = [];
        // normalize app widget data
        foreach ($query->all() as $entity) {
            $data[] = [
                'id' => $entity->get('id'),
                'model' => $entity->get('content')['model'],
                'name' => $entity->get('name'),
                'path' => $entity->get('content')['path']
            ];
        }

        return [
            ['type' => 'app', 'data' => $data]
        ];
    }
private function getAppWidgets(): array
    {
        $table = TableRegistry::get('Search.AppWidgets');

        $query = $table->find('all')
            ->select(['id', 'name', 'content']);

        if ($query->isEmpty()) {
            return [];
        }

        $data = [];
        // normalize app widget data
        foreach ($query->all() as $entity) {
            $data[] = [
                'id' => $entity->get('id'),
                'model' => $entity->get('content')['model'],
                'name' => $entity->get('name'),
                'path' => $entity->get('content')['path']
            ];
        }

        return [
            ['type' => 'app', 'data' => $data]
        ];
    }
private function getAppWidgets ( ) : array { $ table = TableRegistry :: get ( 'Search.AppWidgets' ) ; $ query = $ table -> find ( 'all' ) -> select ( [ 'id' , 'name' , 'content' ] ) ; if ( $ query -> isEmpty ( ) ) { return [ ] ; } $ data = [ ] ; // normalize app widget data foreach ( $ query -> all ( ) as $ entity ) { $ data [ ] = [ 'id' => $ entity -> get ( 'id' ) , 'model' => $ entity -> get ( 'content' ) [ 'model' ] , 'name' => $ entity -> get ( 'name' ) , 'path' => $ entity -> get ( 'content' ) [ 'path' ] ] ; } return [ [ 'type' => 'app' , 'data' => $ data ] ] ; }
Returns list of widgets defined in the application scope.

@return mixed[]
Returns list of widgets defined in the application scope .