Gc\Tab\Collection::getTabs PHP Method

getTabs() public method

Return all tabs from collection
public getTabs ( boolean $forceReload = false ) : array
$forceReload boolean Force reload collection
return array
    public function getTabs($forceReload = false)
    {
        $tabs = $this->getData('tabs');
        $documentTypeId = $this->getDocumentTypeId();
        if (empty($tabs) or $forceReload == true) {
            if (!empty($documentTypeId)) {
                $rows = $this->fetchAll($this->select(function (Select $select) use($documentTypeId) {
                    $select->where->equalTo('document_type_id', $documentTypeId);
                    $select->order('sort_order ASC');
                }));
            } else {
                $rows = $this->fetchAll($this->select());
            }
            $tabs = array();
            foreach ($rows as $row) {
                $tabs[] = Model::fromArray((array) $row);
            }
            $this->setData('tabs', $tabs);
        }
        return $this->getData('tabs');
    }

Usage Example

Example #1
0
 /**
  * Get Tabs
  *
  * @return \Gc\Tab\Collection
  */
 public function getTabs()
 {
     if ($this->getData('tabs') === null) {
         $tabsCollection = new Tab\Collection();
         $tabsCollection->load($this->getId());
         $this->setData('tabs', $tabsCollection->getTabs());
     }
     return $this->getData('tabs');
 }
All Usage Examples Of Gc\Tab\Collection::getTabs