/** * @param \Generated\Shared\Transfer\BlockTransfer $blockTransfer * * @return int */ public function createBlock(BlockTransfer $blockTransfer) { $cmsBlockEntity = new PavCmsBlock(); $cmsBlockEntity->setName($blockTransfer->getName()); $cmsBlockEntity->setTemplateType($blockTransfer->getTemplateType()); $cmsBlockEntity->save(); $idCmsBlock = $cmsBlockEntity->getIdCmsBlock(); $blockTransfer->setIdCmsBlock($idCmsBlock); $this->touchBlock($idCmsBlock); return $idCmsBlock; }
/** * @param \Orm\Zed\CmsBlock\Persistence\PavCmsBlock $cmsBlock * @param array $formattedLocalizedBlocks * * @return array */ protected function formatMissingLocales(PavCmsBlock $cmsBlock, array $formattedLocalizedBlocks) { $locales = $this->localeFacade->getLocaleCollection(); foreach ($locales as $locale) { $localeName = $locale->getLocaleName(); if (!isset($formattedLocalizedBlocks[$localeName])) { $formattedLocalizedBlocks[$localeName] = [LocalizedBlockForm::FIELD_ID_CMS_LOCALIZED_BLOCK => null, LocalizedBlockForm::FIELD_FK_CMS_BLOCK => $cmsBlock->getIdCmsBlock(), LocalizedBlockForm::FIELD_FK_LOCALE => $locale->getIdLocale(), LocalizedBlockForm::FIELD_VALUES => null]; } } return $formattedLocalizedBlocks; }