pageFactory->create()->getCollection() ->addFieldToFilter('identifier', self::PAGE_IDENTIFIER) ->addStoreFilter(0, false) ->setPageSize(1) ->getFirstItem(); if (!$page->getId()) { return $this; } $content = (string) $page->getContent(); if (str_contains($content, self::RESOURCES_BLOCK)) { return $this; } if (str_contains($content, self::CATEGORY_BLOCK)) { $content = str_replace( self::CATEGORY_BLOCK, self::CATEGORY_BLOCK . PHP_EOL . ' ' . self::RESOURCES_BLOCK, $content ); } else { $feedbackPosition = strpos($content, 'setContent($content)->save(); return $this; } public static function getDependencies(): array { return [CreateShopByCategoryBlock::class]; } public function getAliases(): array { return []; } }