Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractDashboard.php
Go to the documentation of this file.
1 <?php
7 
15 {
21  protected $_collection;
22 
28  protected $_params = [];
29 
33  public function getCollection()
34  {
35  if ($this->_collection === null) {
36  $this->_initCollection();
37  }
38  return $this->_collection;
39  }
40 
44  abstract protected function _initCollection();
45 
51  public function getItems()
52  {
53  return is_array($this->getCollection()) ? $this->getCollection() : $this->getCollection()->getItems();
54  }
55 
59  public function getCount()
60  {
61  return sizeof($this->getItems());
62  }
63 
68  public function getColumn($index)
69  {
70  $result = [];
71  foreach ($this->getItems() as $item) {
72  if (is_array($item)) {
73  if (isset($item[$index])) {
74  $result[] = $item[$index];
75  } else {
76  $result[] = null;
77  }
78  } elseif ($item instanceof \Magento\Framework\DataObject) {
79  $result[] = $item->getData($index);
80  } else {
81  $result[] = null;
82  }
83  }
84  return $result;
85  }
86 
92  public function setParam($name, $value)
93  {
94  $this->_params[$name] = $value;
95  }
96 
101  public function setParams(array $params)
102  {
103  $this->_params = $params;
104  }
105 
110  public function getParam($name)
111  {
112  if (isset($this->_params[$name])) {
113  return $this->_params[$name];
114  }
115 
116  return null;
117  }
118 
122  public function getParams()
123  {
124  return $this->_params;
125  }
126 }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$value
Definition: gender.phtml:16
$this _collection
Definition: coupons.php:7
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18
$index
Definition: list.phtml:44
if(!isset($_GET['name'])) $name
Definition: log.php:14