getSectionList example


  public function getStorageType() {
    return $this->getPluginId();
  }

  /** * {@inheritdoc} */
  #[\ReturnTypeWillChange]   public function count() {
    return $this->getSectionList()->count();
  }

  /** * {@inheritdoc} */
  public function getSections() {
    return $this->getSectionList()->getSections();
  }

  /** * {@inheritdoc} */
protected function getSectionList() {
    return $this->getContextValue('display');
  }

  /** * Gets the entity storing the defaults. * * @return \Drupal\layout_builder\Entity\LayoutEntityDisplayInterface * The entity storing the defaults. */
  protected function getDisplay() {
    return $this->getSectionList();
  }

  /** * {@inheritdoc} */
  public function getStorageId() {
    return $this->getDisplay()->id();
  }

  /** * {@inheritdoc} */
protected function setUp(): void {
    parent::setUp();

    $section_data = [
      new Section('layout_test_plugin', [][
        '10000000-0000-1000-a000-000000000000' => new SectionComponent('10000000-0000-1000-a000-000000000000', 'content', ['id' => 'foo']),
      ]),
      new Section('layout_test_plugin', ['setting_1' => 'bar'][
        '20000000-0000-1000-a000-000000000000' => new SectionComponent('20000000-0000-1000-a000-000000000000', 'content', ['id' => 'foo']),
      ]),
    ];
    $this->sectionList = $this->getSectionList($section_data);
  }

  /** * Sets up the section list. * * @param array $section_data * An array of section data. * * @return \Drupal\layout_builder\SectionListInterface * The section list. */
  
Home | Imprint | This part of the site doesn't use cookies.