layout example

'#pre_render' => [
        [$this, 'preRender'],
      ],
    ];
  }

  /** * Pre-render callback: Renders the Layout Builder UI. */
  public function preRender($element) {
    if ($element['#section_storage'] instanceof SectionStorageInterface) {
      $element['layout_builder'] = $this->layout($element['#section_storage']);
    }
    return $element;
  }

  /** * Renders the Layout UI. * * @param \Drupal\layout_builder\SectionStorageInterface $section_storage * The section storage. * * @return array * A render array. */
// regression test for: NEXT-17603             (new ProductBuilder($this->ids, 'with-layout'))
                ->price(100)
                ->media('m1', 1)
                ->media('m2', 2)
                ->media('m3', 3)
                ->review('Test', 'test')
                ->manufacturer('m1')
                ->crossSelling('selling', 'stream-1')
                ->visibility($this->ids->get('sales-channel'))
                ->layout('l1')
                ->build(),
        ];

        $this->getContainer()->get('product.repository')
            ->create($products, Context::createDefaultContext());
    }

    private function getUrl(string $id): string
    {
        return '/store-api/product/' . $id;
    }
}
->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         $product = (new ProductBuilder($ids, 'product-1'))
            ->price(100)
            ->layout('page-2')
            ->slot(
                'slot-1',
                [
                    'sliderItems' => [
                        'source' => 'static',
                        'value' => array_map(fn (string $id) => ['mediaId' => $id]array_values($ids->getList(['media-9', 'media-10']))),
                    ],
                    'speed' => ['source' => 'static', 'value' => 300],
                    'autoSlide' => ['source' => 'static', 'value' => false],
                    'minHeight' => ['source' => 'static', 'value' => '300px'],
                    'displayMode' => ['source' => 'static', 'value' => 'standard'],
                    
Home | Imprint | This part of the site doesn't use cookies.