setLayoutSettings example

'name' => 'The test entity',
      OverridesSectionStorage::FIELD_NAME => $section_data,
    ]);
    $entity->save();
    return $entity->get(OverridesSectionStorage::FIELD_NAME);
  }

  /** * @covers ::equals */
  public function testEquals() {
    $this->sectionList->getSection(0)->setLayoutSettings(['foo' => 1]);

    $second_section_storage = clone $this->sectionList;
    $this->assertTrue($this->sectionList->equals($second_section_storage));

    $second_section_storage->getSection(0)->setLayoutSettings(['foo' => '1']);
    $this->assertFalse($this->sectionList->equals($second_section_storage));
  }

  /** * @covers ::equals */
  
$this->sectionList->removeSection(0);
    $this->assertSections($expected);
  }

  /** * Tests __clone(). */
  public function testClone() {
    $this->assertSame(['setting_1' => 'Default']$this->sectionList->getSection(0)->getLayoutSettings());

    $new_section_storage = clone $this->sectionList;
    $new_section_storage->getSection(0)->setLayoutSettings(['asdf' => 'qwer']);
    $this->assertSame(['setting_1' => 'Default']$this->sectionList->getSection(0)->getLayoutSettings());
  }

  /** * Asserts that the field list has the expected sections. * * @param \Drupal\layout_builder\Section[] $expected * The expected sections. */
  protected function assertSections(array $expected) {
    $result = $this->sectionList->getSections();
    
    $subform_state = SubformState::createForSubform($form['layout_settings']$form$form_state);
    $this->getPluginForm($this->layout)->submitConfigurationForm($form['layout_settings']$subform_state);

    // If this layout is context-aware, set the context mapping.     if ($this->layout instanceof ContextAwarePluginInterface) {
      $this->layout->setContextMapping($subform_state->getValue('context_mapping', []));
    }

    $configuration = $this->layout->getConfiguration();

    $section = $this->getCurrentSection();
    $section->setLayoutSettings($configuration);
    if (!$this->isUpdate) {
      $this->sectionStorage->insertSection($this->delta, $section);
    }

    $this->layoutTempstoreRepository->set($this->sectionStorage);
    $form_state->setRedirectUrl($this->sectionStorage->getLayoutBuilderUrl());
  }

  /** * {@inheritdoc} */
  
Home | Imprint | This part of the site doesn't use cookies.