Fetch widgets.

@return array
430321
public function filter()
    {
        $widgets = $this->applyFilters();

        return $widgets->sortBy(function (AbstractWidget $w1) {
            return $w1->getOrder();
        });
    }
1238497
public function getUniqueId()
    {
        $parameters = $this->getParameters();
        unset($parameters['module']);
        unset($parameters['action']);

        return WidgetsList::getWidgetUniqueId($this->getModule(), $this->getAction(), $parameters);
    }
178436
public function getWidgetsData(Section $section): array
    {
        switch ($this->config->widgetsStorageType) {
            
            case $this->config::STORAGE_TYPE_DB:
                $storage = new WidgetsDbStorage($this->db);
                break;
                
            case $this->config::STORAGE_TYPE_ARRAY:
                if (!empty($this->config->widgetsStoragePath) 
                && file_exists($this->config->projectPath . $this->config->widgetsStoragePath)) {
                    $storageData = require $this->config->projectPath . $this->config->widgetsStoragePath;
                } else {
                    $storageData = $this->config->widgetsStorageData;
                }
                $storage = new WidgetsArrayStorage($storageData);
                break;
                
            default:
                return [];
                
        }
        
        return $storage->getWidgets($section);
    }
809289
public function all()
    {
        foreach ($this->getAll() as $widget) {
            foreach ($widget as $name => $args) {
                $widgets[] = $this->widget($name, $args);
            }
        }

        return empty($widgets) ? null : trim(implode(PHP_EOL, $widgets));
    }
818987
public function fetch()
    {
        return [
            'name' => $this->getName($this->controllerName),
            'collection' => $this->getCollection(),
            'resource' => $this->getResource(),
            'model' => $this->getModel(),
            'namespace' => $this->getNamespace()
        ];
    }
795098
public function getWidgetMapsForViewAndTemplates()
    {
        $widgetMaps = [];

        foreach ($this->getWidgetMaps() as $_widgetMap) {
            $widgetMaps[] = $_widgetMap;
        }

        if ($template = $this->getTemplate()) {
            $templateWidgetMaps = $template->getWidgetMapsForViewAndTemplates();
            $widgetMaps = array_merge($widgetMaps, $templateWidgetMaps);
        }

        return $widgetMaps;
    }
1092804
public function fetch(): array
    {
        $sql = $this->builder->buildSql();
        $this->builder = new QueryBuilder($this->pdo);
        return $this->fetchBySql($sql);
    }
59149
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;
    }
531027
def core__get_widgets
      lato_modules = core__get_modules_list
      # create list of widgets
      widgets = []
      lato_modules.each do |lato_module_name|
        module_widgets = core__get_widgets_for_module(lato_module_name)
        widgets = widgets + module_widgets if module_widgets
      end
      # sort items and return them
      widgets = widgets.sort_by {|widget| widget[:position]}
      return widgets.reverse
    end
27601
public function getViewWidgetViewHelper()
    {
        $config = $this->serviceLocator
                       ->get( 'Config' );

        return View\Helper\ViewWidget::factory(
            $this->serviceLocator,
            empty( $config['view_widgets'] ) ? array() : $config['view_widgets']
        );
    }
97507
public function get_data() {
		$settings = $this->get_settings()[ $this->number ];

		return array_merge(
			[ 'title' => $settings['title'] ],
			Acf::get_widget_field( $this->id )
		);
	}
1160072
private function getSavedSearchWidgets(): array
    {
        $table = TableRegistry::get('Search.SavedSearches');

        $query = $table->find('all')
            ->where([
                'SavedSearches.name IS NOT' => null,
                'SavedSearches.name !=' => '',
                'SavedSearches.system' => false
            ])
            ->enableHydration(false)
            ->indexBy('id');

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

        return [
            ['type' => 'saved_search', 'data' => $query->toArray()]
        ];
    }
91125
public function options()
    {
        $params = $this->params;
        return [
            'id'      => isset($params['id']) ? $params['id'] : null,
            'data'    => isset($params['data']) ? $params['data'] : null,
            'widgets' => isset($params['widgets']) ? $params['widgets'] : null,
        ];
    }
1025696
public function getProspectsDataForWidgets($widgetId = '')
	{
	    
	    $prospectsTable = $this->getServiceLocator()->get('MelisProspects');
	    
	    $dataProspects = $prospectsTable->getProspectsOrderByDate();
	
	    $numPropects = 0;
	    $numPropectsMonth = 0;
	    $numPropectsMonthAvg = 0;
	
	    if (!empty($dataProspects))
	    {
	        $datas = $dataProspects->toArray();
	        if (!empty($datas))
	        {
	            $numPropects = count($datas);
	
	            $curMonthYear = date('m-Y'); // Current Month
	            $sumMonthProspects = 0; // Sum of the Months Prospects
	            $flagFirstDate = TRUE;
	            $firstDate = '';
	
	            for ($i = 0; $i < $numPropects; $i++)
	            {
	                $dataMonthYear = date('m-Y',strtotime($datas[$i]['pros_contact_date'])); // Get Month value from Data
	                if($dataMonthYear == $curMonthYear)
	                {
	                    $numPropectsMonth++;
	                }
	
	                if ($flagFirstDate)
	                {
	                    $firstDate = date('Y-m-d',strtotime($datas[$i]['pros_contact_date']));
	                    $flagFirstDate = FALSE; // Set False After get the First Date of Prospects
	                }
	            }
	
	            $numMonths = 0; // Number of Months
	            if ($numPropects != 0 && $firstDate != '')
	            {
	                // Variable initialization
	                $totalNum = null;
	                $test = null;
	                $flag = TRUE;
	                $currentDate = date('Y-m');
	                $tempDate = date('Y-m',strtotime($firstDate));
	                do {
	                    // check if tempDate still on range
	                    if ($tempDate<=$currentDate){
	                        // checking date is same as firstDate
	                        if(date('Y-m',strtotime($firstDate))==$tempDate){
	                            // getting value of the firstDate
	                            $totalNum += date('d',strtotime($firstDate))/date('t',strtotime($firstDate));
	                        }else{
	                            // checking if tempDate is the last date of the range
	                            if (date('Y-m')==$tempDate){
	                                // getting value of the last date of range
	                                // last date is the current date
	                                $totalNum += date('d')/date('t');
	                            }else{
	                                $totalNum++;
	                            }
	                        }
	                        // Add 1 month to set tempMonth to next month
	                        $tempDate = date('Y-m',strtotime($tempDate.' +1 months'));
	                    }else{
	                        $flag = FALSE;
	                    }
	                }while($flag);
	                //Compute Average Prospects per month
	                $numPropectsMonthAvg = $numPropects/$totalNum;
	            }
	        }
	    }
	
	    // Check and return value requested
	    switch ($widgetId) {
	        case 'numPropects':
	            return number_format($numPropects); // return total number of prospects
	            break;
	        case 'numPropectsMonth':
	            return number_format($numPropectsMonth); // return total number of prospects of the current month
	            break;
	        case 'numPropectsMonthAvg':
	            return number_format($numPropectsMonthAvg,2); // return average of the total number of prospects
	            break;
	        default:
	            return null;
	            break;
	    }
	
	}
1102530
private function getReportWidgets(): array
    {
        $event = new Event((string)EventName::MODEL_DASHBOARDS_GET_REPORTS(), $this);
        EventManager::instance()->dispatch($event);

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

        $result = [];
        foreach ($event->result as $reports) {
            foreach ($reports as $report) {
                if (! isset($result[$report['widget_type']])) {
                    $result[$report['widget_type']] = ['type' => $report['widget_type'], 'data' => []];
                }
                $result[$report['widget_type']]['data'][$report['id']] = $report;
            }
        }

        return array_values($result);
    }
1371653
public static function get()
    {
        $widgets = [];
        foreach (Packages::all() as $package) {
            $dir = __DIR__.'/../../'.$package.'/src';
            $files = is_dir($dir) ? scandir($dir) : [];

            foreach ($files as $file) {
                if ($file == 'Widgets.json') {
                    $file_r = file_get_contents($dir.'/'.$file);
                    foreach (json_decode($file_r, true) as $w) {
                        $w['package'] = $package;
                        array_push($widgets, $w);
                    }
                    break;
                }
            }
        }

        $widgets = static::orderByPreference($widgets);

        return $widgets;
    }
1069674
public function getMessages()
    {
        $messages = parent::getMessages();

        if ($this->model !== null) {
            foreach ($this->model as $row) {
                foreach ($this->columns as $column) {
                    $messages = array_merge(
                        $messages,
                        $column->getMessages($row)
                    );
                }

                foreach ($this->spanning_columns as $column) {
                    $messages = array_merge(
                        $messages,
                        $column->getMessages($row)
                    );
                }
            }

            foreach ($this->extra_rows as $row) {
                if ($row instanceof SwatTableViewWidgetRow) {
                    $messages = array_merge($messages, $row->getMessages());
                }
            }
        }

        return $messages;
    }