_db->select(); $select->from($this->_getPair($this->_tableAlias . 'Item')); $select->where('`blockId` = ?', $data['id'], Qs_Db::INT_TYPE); $data['items'] = $this->_db->fetchAll($select); } return $this; } protected function _prepareRow(array &$row) { if (!empty($row['items'])) { $this->_prepareRowItems($row['items']); } return parent::_prepareRow($row); } protected function _prepareRowItems(array &$items) { static $config; if (null === $config) { $config = Qs_Config::getByClass('App\GridBlock\Item\Admin\View')->toArray(); } foreach ($items as &$item) { if (!empty($item['image'])) { $size = $item['width'] . 'x' . $item['height']; if (!array_key_exists($size, $config['image'])) { throw new Exception('Unknown block size'); } $size = $config['image'][$size]; $item['backgroundImage'] = Qs_ImageFs::get($item['image'], $size['width'], $size['height'], $size['method']); } if (!empty($item['video'])) { $item['video'] = $this->_tag2BaseUrl($item['video']); } if (!empty($item['content'])) { $item['content'] = $this->_tag2BaseUrl($item['content']); } } return $this; } }