metadataPool->getMetadata(BlockInterface::class); $this->performAfterLoad('cms_block_store', $entityMetadata->getLinkField()); return parent::_afterLoad(); } /** * Define resource model * * @return void */ protected function _construct() { $this->_init(\Magento\Cms\Model\Block::class, \Magento\Cms\Model\ResourceModel\Block::class); $this->_map['fields']['store'] = 'store_table.store_id'; $this->_map['fields']['block_id'] = 'main_table.block_id'; } /** * Returns pairs block_id - title * * @return array */ public function toOptionArray() { return $this->_toOptionArray('block_id', 'title'); } /** * Add filter by store * * @param int|array|\Magento\Store\Model\Store $store * @param bool $withAdmin * @return $this */ public function addStoreFilter($store, $withAdmin = true) { $this->performAddStoreFilter($store, $withAdmin); return $this; } /** * Join store relation table if there is store filter * * @return void */ protected function _renderFiltersBefore() { $entityMetadata = $this->metadataPool->getMetadata(BlockInterface::class); $this->joinStoreRelationTable('cms_block_store', $entityMetadata->getLinkField()); } }