Ejemplo n.º 1
0
 public function getAvailableCustomColumns($grouped = false, $withTypeCode = false)
 {
     if (!is_null($this->_typeModel)) {
         $columns = $this->_typeModel->getCustomColumns($this->getBlockType(), $this->getRewritingClassName());
         $usedCodes = $this->getUsedCustomColumnsCodes();
         $typeCode = $this->_typeModel->getCode();
         if ($grouped) {
             $result = array();
             foreach ($columns as $code => $column) {
                 if (!isset($result[$column->getGroupId()])) {
                     $result[$column->getGroupId()] = array();
                 }
                 if (in_array($code, $usedCodes)) {
                     $column->setSelected(true);
                 }
                 if ($withTypeCode) {
                     $this->_addTypeToCustomColumnCode($code, null, $typeCode);
                 }
                 $result[$column->getGroupId()][$code] = $column;
             }
             $columns = $result;
         } elseif ($withTypeCode) {
             $result = array();
             foreach ($columns as $code => $column) {
                 $this->_addTypeToCustomColumnCode($code, null, $typeCode);
                 $result[$code] = $column;
             }
             $columns = $result;
         }
         return $columns;
     }
     return array();
 }