Mercurial > hg > isophonics-drupal-site
comparison core/modules/layout_builder/src/Section.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 1fec387a4317 |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
320 } | 320 } |
321 | 321 |
322 /** | 322 /** |
323 * Returns an array representation of the section. | 323 * Returns an array representation of the section. |
324 * | 324 * |
325 * @internal | 325 * Only use this method if you are implementing custom storage for sections. |
326 * This is intended for use by a storage mechanism for sections. | |
327 * | 326 * |
328 * @return array | 327 * @return array |
329 * An array representation of the section component. | 328 * An array representation of the section component. |
330 */ | 329 */ |
331 public function toArray() { | 330 public function toArray() { |
336 return $component->toArray(); | 335 return $component->toArray(); |
337 }, $this->getComponents()), | 336 }, $this->getComponents()), |
338 ]; | 337 ]; |
339 } | 338 } |
340 | 339 |
340 /** | |
341 * Creates an object from an array representation of the section. | |
342 * | |
343 * Only use this method if you are implementing custom storage for sections. | |
344 * | |
345 * @param array $section | |
346 * An array of section data in the format returned by ::toArray(). | |
347 * | |
348 * @return static | |
349 * The section object. | |
350 */ | |
351 public static function fromArray(array $section) { | |
352 return new static( | |
353 $section['layout_id'], | |
354 $section['layout_settings'], | |
355 array_map([SectionComponent::class, 'fromArray'], $section['components']) | |
356 ); | |
357 } | |
358 | |
341 } | 359 } |