get(BlockRepositoryInterface::class); /** @var BlockInterfaceFactory $blockFactory */ $blockFactory = Bootstrap::getObjectManager()->get(BlockInterfaceFactory::class); $storeId = Bootstrap::getObjectManager()->get(StoreManagerInterface::class)->getStore()->getId(); /** @var BlockInterface $block */ $block = $blockFactory->create([ 'data' => [ BlockInterface::IDENTIFIER => 'enabled_block', BlockInterface::TITLE => 'Enabled CMS Block Title', BlockInterface::CONTENT => '

Enabled Block

store url

Config value: "{{config path="web/unsecure/base_url"}}".

Custom variable: "{{customvar code="variable_code"}}".

', BlockInterface::IS_ACTIVE => 1, 'store_id' => [$storeId], ] ]); $blockRepository->save($block); /** @var BlockInterface $block */ $block = $blockFactory->create([ 'data' => [ BlockInterface::IDENTIFIER => 'disabled_block', BlockInterface::TITLE => 'Disabled CMS Block Title', BlockInterface::CONTENT => '

Disabled Block

store url

Config value: "{{config path="web/unsecure/base_url"}}".

Custom variable: "{{customvar code="variable_code"}}".

', BlockInterface::IS_ACTIVE => 0, 'store_id' => [$storeId], ] ]); $blockRepository->save($block);