Returns columns for the grid fields on this report.

@param string $itemType (i.e 'Pages' or 'Files')

@return array
773739
public function columns($itemType = 'Pages')
    {
        $columns = [
            'Title' => [
                'title' => _t(__CLASS__ . '.Name', 'Name'),
                'link' => true,
            ],
            'Created' => [
                'title' => _t(__CLASS__ . '.Created', 'Date created'),
                'formatting' => function ($value, $item) {
                    return $item->dbObject('Created')->Nice();
                },
            ],
            'LastEdited' => [
                'title' => _t(__CLASS__ . '.LastEdited', 'Date last edited'),
                'formatting' => function ($value, $item) {
                    return $item->dbObject('LastEdited')->Nice();
                },
            ],
        ];

        if ($itemType === 'Pages') {
            // Page specific fields
            $columns['i18n_singular_name'] = _t(__CLASS__ . '.PageType', 'Page type');
            $columns['StageState'] = [
                'title' => _t(__CLASS__ . '.Stage', 'Stage'),
                'formatting' => function ($value, $item) {
                    // Stage only
                    if (!$item->isPublished()) {
                        return _t(__CLASS__ . '.Draft', 'Draft');
                    }

                    // Pending changes
                    if ($item->isModifiedOnDraft()) {
                        return _t(__CLASS__ . '.PublishedWithChanges', 'Published (with changes)');
                    }

                    // If on live and unmodified
                    return _t(__CLASS__ . '.Published', 'Published');
                },
            ];
            $columns['RelativeLink'] = _t(__CLASS__ . '.Link', 'Link');
            $columns['MetaDescription'] = [
                'title' => _t(__CLASS__ . '.MetaDescription', 'Description'),
                'printonly' => true,
            ];
        } else {
            // File specific fields
            $columns['FileType'] = [
                'title' => _t(__CLASS__ . '.FileType', 'File type'),
                'datasource' => function ($record) {
                    // Handle folders separately
                    if ($record instanceof Folder) {
                        return $record->i18n_singular_name();
                    }

                    return $record->getFileType();
                }
            ];
            $columns['Size'] = _t(__CLASS__ . '.Size', 'Size');
            $columns['Filename'] = _t(__CLASS__ . '.Directory', 'Directory');
        }

        $this->extend('updateColumns', $itemType, $columns);

        return $columns;
    }
1339267
private function getColumns($data)
        {
            $cols = [];

            foreach ($data[0] as $key => $value) {
                if (is_numeric($key)){
                    if (is_string($data[1][$key])) {
                        $cols[] = ['id' => '', 'label' => $value, 'type' => 'string'];
                    } else {
                        $cols[] = ['id' => '', 'label' => $value, 'type' => 'number'];
                    }

                    $this->_skipFirstRow = true;
                } else {
                    if (is_string($value)) {
                        $cols[] = ['id' => '', 'label' => $key, 'type' => 'string'];
                    } else {
                        $cols[] = ['id' => '', 'label' => $key, 'type' => 'number'];
                    }
                }
            }

            return $cols;
        }
305605
public function & GetFieldsByType ($fieldType = '') {
		$result = [];
		foreach ($this->fields as & $field) {
			if ($field->GetType() == $fieldType)
				$result[$field->GetName()] = $field;
		}
		return $result;
	}
1021825
public function getGridColumn($columns=null) {
		if($columns !== null) {
			foreach($columns as $val) {
				/*
				if(trim($val) == 'enabled') {
					$this->defaultColumns[] = array(
						'name'  => 'enabled',
						'value' => '$data->enabled == 1? "Ya": "Tidak"',
					);
				}
				*/
				$this->defaultColumns[] = $val;
			}
		} else {
			//$this->defaultColumns[] = 'comment_id';
			$this->defaultColumns[] = 'publish';
			$this->defaultColumns[] = 'parent_id';
			$this->defaultColumns[] = 'wall_id';
			$this->defaultColumns[] = 'user_id';
			$this->defaultColumns[] = 'comment';
			$this->defaultColumns[] = 'creation_date';
			$this->defaultColumns[] = 'modified_date';
		}

		return $this->defaultColumns;
	}
1242704
public function getAllItems($itemType, array $queryString = []) {
      $options = [];
      if ($queryString) {
         $options['query'] = $queryString;
      }
      $response = $this->client->request('get', $itemType . '/', $options);
      $contentRange = $response->getHeader('Content-Range');
      $acceptRange = $response->getHeader('Accept-Range');
      return [
         'statusCode' => $response->getStatusCode(),
         'body' => $response->getBody()->getContents(),
         'contentRange' => ($contentRange) ? $contentRange[0] : null,
         'acceptRange' => ($acceptRange) ? $acceptRange[0] : null,
      ];
   }
565459
private function getColumns()
    {
        return [
            [
                'data'      => 'status',
                'name'      => 'articles.published',
                'width'     => '100px',
                'title'     => trans('cms::article.datatable.columns.status'),
                'orderable' => false,
            ],
            [
                'data'  => 'title',
                'name'  => 'articles.title',
                'title' => trans('cms::article.datatable.columns.title'),
            ],
            [
                'data'    => 'alias',
                'name'    => 'articles.alias',
                'visible' => false,
            ],
            [
                'data'    => 'category',
                'name'    => 'category.title',
                'visible' => false,
            ],
            [
                'data'  => 'category',
                'name'  => 'category.id',
                'title' => trans('cms::article.datatable.columns.category'),
                'width' => '100px',
            ],
            [
                'data'       => 'author',
                'title'      => trans('cms::article.datatable.columns.author'),
                'searchable' => false,
                'orderable'  => false,
            ],
            [
                'data'  => 'created_at',
                'name'  => 'articles.created_at',
                'title' => trans('cms::article.datatable.columns.created_at'),
                'width' => '90px',
            ],
            [
                'data'  => 'authenticated',
                'name'  => 'articles.authenticated',
                'width' => '20px',
                'title' => '<i class="fa fa-key" data-toggle="tooltip" data-title="' . trans('cms::article.datatable.columns.authenticated') . '"></i>',
            ],
            [
                'data'  => 'is_page',
                'name'  => 'articles.is_page',
                'title' => trans('cms::article.datatable.columns.is_page'),
                'width' => '20px',
            ],
            [
                'data'  => 'hits',
                'name'  => 'articles.hits',
                'width' => '20px',
                'title' => 'Hits',
            ],
            [
                'data'  => 'id',
                'name'  => 'articles.id',
                'title' => trans('cms::article.datatable.columns.id'),
                'width' => '10px',
            ],
        ];
    }
976112
function data($items = null): array
    {
        $this->putRetainedFilterValuesInSession();

        $items = $items ?: $this->getListData(
            EntityListQueryParams::create()
                ->setDefaultSort($this->defaultSort, $this->defaultSortDir)
                ->fillWithRequest()
                ->setDefaultFilters($this->getFilterDefaultValues())
        );

        if($items instanceof LengthAwarePaginator) {
            $page = $items->currentPage();
            $totalCount = $items->total();
            $pageSize = $items->perPage();
            $items = $items->items();
        }

        $this->addInstanceCommandsAuthorizationsToConfigForItems($items);

        $keys = $this->getDataKeys();

        return [
            "items" =>
                collect($items)
                    ->map(function($row) use($keys) {
                        // Filter model attributes on actual form fields
                        return collect($row)->only(
                            array_merge(
                                $this->entityStateAttribute ? [$this->entityStateAttribute] : [],
                                $this->multiformAttribute ? [$this->multiformAttribute] : [],
                                [$this->instanceIdAttribute],
                                $keys
                            )
                        )->all();
                    })->all()
        ] + (isset($page) ? compact('page', 'totalCount', 'pageSize') : []);
    }
1173747
public function getItemViewType(string $itemViewType): ItemViewType
    {
        if (!$this->hasItemViewType($itemViewType)) {
            throw BlockDefinitionException::noItemViewType($this->identifier, $itemViewType);
        }

        return $this->itemViewTypes[$itemViewType];
    }
1363751
protected function getQueryBuilderForContainsMethods(string $itemType, int $itemUid) : QueryBuilder
    {
        $queryBuilder = $this->getQueryBuilder();
        return $queryBuilder->count('uid')->from($this->table)
            ->andWhere(
                $queryBuilder->expr()->eq('item_type', $queryBuilder->createNamedParameter($itemType)),
                $queryBuilder->expr()->eq('item_uid', $itemUid)
            );
    }
1057138
private function getColumns()
    {
        $columns = array();
        
        /**
         * Use call_user_func to make sure only public vars are returned
         */
        $vars = call_user_func('get_object_vars', $this);
        
        foreach ( $vars as $key => $value )
        {
            $columns[] = array(
                "name" => $key
            );
        }
        
        return $columns;
    }
278768
public function getColumnMetadata($gridField, $column)
    {
        $columns = $this->getDisplayFields($gridField);

        $title = null;
        if (is_string($columns[$column])) {
            $title = $columns[$column];
        } elseif (is_array($columns[$column]) && isset($columns[$column]['title'])) {
            $title = $columns[$column]['title'];
        }

        return array(
            'title' => $title,
        );
    }
395415
public function columnsByType(int $type) : array
    {
        $n = $this->numColumns();

        $columns = [];

        for ($i = 0; $i < $n; $i++) {
            if ($this->columnType($i) === $type) {
                $columns[$i] = $this->column($i);
            }
        }

        return $columns;
    }
820953
public function getItemsPerPageList()
	{
		if (empty($this->items_per_page_list)) {
			$this->setItemsPerPageList([10, 20, 50], true);
		}

		$list = array_flip($this->items_per_page_list);

		foreach ($list as $key => $value) {
			$list[$key] = $key;
		}

		if (array_key_exists('all', $list)) {
			$list['all'] = $this->getTranslator()->translate('ublaboo_datagrid.all');
		}

		return $list;
	}
6136
public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        if (!$this->isAllowedChildren()) {
            return $fields;
        }
        $fields->addFieldsToTab(
            'Root.' . _t(__CLASS__ . '.CHILDREN', 'Children'),
            [
                GridField::create(
                    'Children',
                    _t(__CLASS__ . '.CHILDREN', 'Children'),
                    $this->Children(),
                    GridFieldConfig_RecordEditor::create()
                        ->addComponent(new GridFieldOrderableRows())
                )
            ]
        );

        return $fields;
    }
640503
protected function getItem($itemType, $itemId, TagAttributes $attr)
    {
        $data = '';

        switch ($itemType) {

            case self::LAYOUT_WIDGET:
                try {
                    /** @var $data \PageBuilder\BaseWidget */
                    $widgetName = $itemId . WidgetFactory::WIDGET_SUFFIX;
                    $options    = $attr->getOptions();

                    if (!$this->isShared($options)) {
                        $this->getServiceLocator()->setShared($widgetName, false);
                    }

                    if (array_key_exists('shared', $options) and empty($options['shared'])) {
                        $this->getServiceLocator()->setShared($widgetName, false);
                    }

                    $data = $this->getServiceLocator()->get($widgetName);
                    $attr->addClass($data->getId());
                    $data->setAttributes($attr);
                } catch (ServiceNotFoundException $e) {
                    $data = '';
                }

                break;
            case self::LAYOUT_USER_DEFINED:
                /** @var $componentModel \PageBuilder\Model\ComponentModel */
                $componentModel = $this->getServiceLocator()->get('pagebuilder\model\component');

                /** @var $component \PageBuilder\Entity\Component */
                if ($component = $componentModel->findOneTranslatedBy(['id' => $itemId])) {
                    $data     = $this->transform($component->getContent());
                    $comId    = "data-id='{$itemType}-{$itemId}'";
                    $cssClass = trim("{$itemType} {$component->getCssClass()}");
                    $attr->addClass($cssClass)
                        ->addClass($component->getCssId())
                        ->addAttr($comId)
                        ->addAttr("id='{$component->getCssId()}'");

                    //Apply replaces to the output
                    $replacements = $this->getOptions()->getReplacements();
                    $data         = str_replace(array_keys($replacements), array_values($replacements), $data);

                    //apply formats to the data
                    $data = $this->applyFormats($data);
                }

                break;
            default:
                $message = 'Layout itemType ' . $itemType . ' not found';
                if ($this->serviceManager->has('logger')) {
                    $this->serviceManager->get('logger')->err($message);
                } else {
                    throw new RuntimeException($message);
                }
        }

        return new WidgetData(
            [
                'data'       => $data,
                'attributes' => $attr,
            ]
        );
    }
1089337
public function updateColumns($itemType, &$columns)
    {
        if ($itemType !== 'Pages') {
            return;
        }

        // {@see SiteTreeContentReview::getOwnerNames()}
        $columns['OwnerNames'] = [
            'printonly' => true, // Hide on page report
            'title' => _t('SilverStripe\\SiteWideContentReport\\SitewideContentReport.Reviewer', 'Reviewer'),
        ];

        // {@see SiteTreeContentView::getReviewDate()}
        $columns['ReviewDate'] = [
            'printonly' => true, // Hide on page report
            'title' => _t('SilverStripe\\SiteWideContentReport\\SitewideContentReport.ReviewDate', 'Review Date'),
            'formatting' => function ($value, $record) {
                if ($val = $record->getReviewDate()) {
                    return $val->Nice();
                }

                return null;
            },
        ];

        return;
    }
1265043
public function getColNames()
    {
        $colNames = array();
        foreach ($this->_array as $row) {
            foreach (array_keys($row) as $key) {
                if (!is_numeric($key) && !isset($colNames[$key])) {
                    $colNames[$key] = $key;
                }
            }
        }
        return $colNames;
    }