LayoutBuilder example

'fileName' => "Media $i",
                'fileExtension' => 'jpg',
                'mimeType' => 'image/jpeg',
                'fileSize' => 12345,
            ];
        }
        $this->mediaRepository->create($media, Context::createDefaultContext());

        $mediaIds = $ids->all();

        $pages = [];
        $pages[] = (new LayoutBuilder($ids, 'page-1'))
            ->image('media-1')
            ->image('media-2')
            ->build();

        $pages[] = (new LayoutBuilder($ids, 'page-2'))
            ->imageSlider(['media-3', 'media-4'])
            ->imageSlider(['media-4', 'media-5'])
            ->imageGallery(['media-6', 'media-7', 'media-8'])
            ->build();

        // create a product with image slider, and image override
return $this;
    }

    public function layout(string $key): self
    {
        if ($this->ids->has($key)) {
            $this->cmsPage = ['id' => $this->ids->get($key)];

            return $this;
        }

        $this->cmsPage = (new LayoutBuilder($this->ids, $key, 'detailpage'))
            ->productHeading()
            ->galleryBuybox()
            ->descriptionReviews()
            ->crossSelling()
            ->build();

        return $this;
    }

    /** * @param array<mixed> $value */
return $this;
    }

    public function layout(string $key): self
    {
        if ($this->ids->has($key)) {
            $this->cmsPage = ['id' => $this->ids->get($key)];

            return $this;
        }

        $this->cmsPage = (new LayoutBuilder($this->ids, $key, 'categorypage'))
            ->build();

        return $this;
    }

    /** * @param array<mixed> $value */
    public function slot(string $key, array $value, string $languageId = Defaults::LANGUAGE_SYSTEM): self
    {
        if (isset($this->translations[$languageId]['slotConfig']) && \is_array($this->translations[$languageId]['slotConfig'])) {
            
->price(100)
                ->visibility()
                ->build(),
        ];

        $this->getContainer()->get('product.repository')->create($products$context->getContext());

        $this->context = $this->getContainer()
            ->get(SalesChannelContextFactory::class)
            ->create(Uuid::randomHex(), TestDefaults::SALES_CHANNEL);

        $builder = new LayoutBuilder($ids, 'layout');
        $builder
            ->productSlider(['other-slider-product', 'slider-delete', 'slider-remove'])
            ->listing()
            ->productThreeColumnBlock(['other-box-product', 'box-delete', 'other-box-product'])
            ->productStreamSlider('stream')
        ;

        // generate layout with product boxes, listing and slider         $this->getContainer()->get('cms_page.repository')->create([$builder->build()]$context->getContext());

        $update = [
            
Home | Imprint | This part of the site doesn't use cookies.