Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / layout_builder / src / SectionListInterface.php
1 <?php
2
3 namespace Drupal\layout_builder;
4
5 /**
6  * Defines the interface for an object that stores layout sections.
7  *
8  * @internal
9  *   Layout Builder is currently experimental and should only be leveraged by
10  *   experimental modules and development releases of contributed modules.
11  *   See https://www.drupal.org/core/experimental for more information.
12  *
13  * @see \Drupal\layout_builder\Section
14  */
15 interface SectionListInterface extends \Countable {
16
17   /**
18    * Gets the layout sections.
19    *
20    * @return \Drupal\layout_builder\Section[]
21    *   A sequentially and numerically keyed array of section objects.
22    */
23   public function getSections();
24
25   /**
26    * Gets a domain object for the layout section.
27    *
28    * @param int $delta
29    *   The delta of the section.
30    *
31    * @return \Drupal\layout_builder\Section
32    *   The layout section.
33    */
34   public function getSection($delta);
35
36   /**
37    * Appends a new section to the end of the list.
38    *
39    * @param \Drupal\layout_builder\Section $section
40    *   The section to append.
41    *
42    * @return $this
43    */
44   public function appendSection(Section $section);
45
46   /**
47    * Inserts a new section at a given delta.
48    *
49    * If a section exists at the given index, the section at that position and
50    * others after it are shifted backward.
51    *
52    * @param int $delta
53    *   The delta of the section.
54    * @param \Drupal\layout_builder\Section $section
55    *   The section to insert.
56    *
57    * @return $this
58    */
59   public function insertSection($delta, Section $section);
60
61   /**
62    * Removes the section at the given delta.
63    *
64    * As sections are stored sequentially and numerically this will re-key every
65    * subsequent section, shifting them forward.
66    *
67    * @param int $delta
68    *   The delta of the section.
69    *
70    * @return $this
71    */
72   public function removeSection($delta);
73
74 }