public static function SectionComponent::fromArray in Drupal 10
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/SectionComponent.php \Drupal\layout_builder\SectionComponent::fromArray()
- 9 core/modules/layout_builder/src/SectionComponent.php \Drupal\layout_builder\SectionComponent::fromArray()
Creates an object from an array representation of the section component.
Only use this method if you are implementing custom storage for sections.
Parameters
array $component: An array of section component data in the format returned by ::toArray().
Return value
static The section component object.
File
- core/
modules/ layout_builder/ src/ SectionComponent.php, line 311
Class
- SectionComponent
- Provides a value object for a section component.
Namespace
Drupal\layout_builderCode
public static function fromArray(array $component) {
return (new static($component['uuid'], $component['region'], $component['configuration'], $component['additional']))
->setWeight($component['weight']);
}