/** * Function returns all the blocks for the module * @return <Array of Vtiger_Block_Model> - list of block models */ public function getBlocks() { if (empty($this->blocks)) { $blocksList = array(); $moduleBlocks = Vtiger_Block_Model::getAllForModule($this); foreach ($moduleBlocks as $block) { $blocksList[$block->get('label')] = $block; } $this->blocks = $blocksList; } return $this->blocks; }
/** * Function to retrieve block instances for a module * @param <type> $moduleModel - module instance * @return <array> - list of Vtiger_Block_Model */ public static function getAllForModule($moduleModel) { $blockObjects = parent::getAllForModule($moduleModel); $blockModelList = array(); if ($blockObjects) { foreach ($blockObjects as $blockObject) { $blockModelList[] = self::getInstanceFromBlockObject($blockObject); } } return $blockModelList; }