/**
* Returns an array representation of the section.
*
- * @internal
- * This is intended for use by a storage mechanism for sections.
+ * Only use this method if you are implementing custom storage for sections.
*
* @return array
* An array representation of the section component.
];
}
+ /**
+ * Creates an object from an array representation of the section.
+ *
+ * Only use this method if you are implementing custom storage for sections.
+ *
+ * @param array $section
+ * An array of section data in the format returned by ::toArray().
+ *
+ * @return static
+ * The section object.
+ */
+ public static function fromArray(array $section) {
+ return new static(
+ $section['layout_id'],
+ $section['layout_settings'],
+ array_map([SectionComponent::class, 'fromArray'], $section['components'])
+ );
+ }
+
}