Chris@14: layoutTempstoreRepository = $layout_tempstore_repository; Chris@14: } Chris@14: Chris@14: /** Chris@14: * {@inheritdoc} Chris@14: */ Chris@14: public static function create(ContainerInterface $container) { Chris@14: return new static( Chris@18: $container->get('layout_builder.tempstore_repository') Chris@14: ); Chris@14: } Chris@14: Chris@14: /** Chris@14: * Adds the new section. Chris@14: * Chris@14: * @param \Drupal\layout_builder\SectionStorageInterface $section_storage Chris@14: * The section storage. Chris@14: * @param int $delta Chris@14: * The delta of the section to splice. Chris@14: * @param string $plugin_id Chris@14: * The plugin ID of the layout to add. Chris@14: * Chris@14: * @return \Symfony\Component\HttpFoundation\Response Chris@14: * The controller response. Chris@14: */ Chris@14: public function build(SectionStorageInterface $section_storage, $delta, $plugin_id) { Chris@14: $section_storage->insertSection($delta, new Section($plugin_id)); Chris@14: Chris@14: $this->layoutTempstoreRepository->set($section_storage); Chris@14: Chris@14: if ($this->isAjax()) { Chris@14: return $this->rebuildAndClose($section_storage); Chris@14: } Chris@14: else { Chris@14: $url = $section_storage->getLayoutBuilderUrl(); Chris@14: return new RedirectResponse($url->setAbsolute()->toString()); Chris@14: } Chris@14: } Chris@14: Chris@14: }