src/Model/Table/WidgetsTable.php
public function getWidgets(): array
    {
        // get widgets through Event broadcast
        $event = new Event((string)EventName::MODEL_DASHBOARDS_GET_WIDGETS(), $this);
        $this->getEventManager()->dispatch($event);

        if (empty($event->getResult())) {
            return [];
        }

        // assembling all widgets in one
        $result = [];
        foreach ((array)$event->getResult() as $widget) {
            if (empty($widget['data'])) {
                continue;
            }

            $instance = WidgetFactory::create($widget['type']);

            foreach ($widget['data'] as $data) {
                array_push($result, [
                    'type' => $widget['type'],
                    'title' => $instance->getTitle(),
                    'icon' => $instance->getIcon(),
                    'color' => $instance->getColor(),
                    'data' => $data
                ]);
            }
        }

        return $result;
    }
public function getWidgets(): array
    {
        // get widgets through Event broadcast
        $event = new Event((string)EventName::MODEL_DASHBOARDS_GET_WIDGETS(), $this);
        $this->getEventManager()->dispatch($event);

        if (empty($event->getResult())) {
            return [];
        }

        // assembling all widgets in one
        $result = [];
        foreach ((array)$event->getResult() as $widget) {
            if (empty($widget['data'])) {
                continue;
            }

            $instance = WidgetFactory::create($widget['type']);

            foreach ($widget['data'] as $data) {
                array_push($result, [
                    'type' => $widget['type'],
                    'title' => $instance->getTitle(),
                    'icon' => $instance->getIcon(),
                    'color' => $instance->getColor(),
                    'data' => $data
                ]);
            }
        }

        return $result;
    }
public function getWidgets ( ) : array { // get widgets through Event broadcast $ event = new Event ( ( string ) EventName :: MODEL_DASHBOARDS_GET_WIDGETS ( ) , $ this ) ; $ this -> getEventManager ( ) -> dispatch ( $ event ) ; if ( empty ( $ event -> getResult ( ) ) ) { return [ ] ; } // assembling all widgets in one $ result = [ ] ; foreach ( ( array ) $ event -> getResult ( ) as $ widget ) { if ( empty ( $ widget [ 'data' ] ) ) { continue ; } $ instance = WidgetFactory :: create ( $ widget [ 'type' ] ) ; foreach ( $ widget [ 'data' ] as $ data ) { array_push ( $ result , [ 'type' => $ widget [ 'type' ] , 'title' => $ instance -> getTitle ( ) , 'icon' => $ instance -> getIcon ( ) , 'color' => $ instance -> getColor ( ) , 'data' => $ data ] ) ; } } return $ result ; }
getWidgets method.

@return mixed[] $result containing all widgets
getWidgets method .