comparison core/modules/layout_builder/src/SectionComponent.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 1fec387a4317
children af1871eacc83
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
290 } 290 }
291 291
292 /** 292 /**
293 * Returns an array representation of the section component. 293 * Returns an array representation of the section component.
294 * 294 *
295 * @internal 295 * Only use this method if you are implementing custom storage for sections.
296 * This is intended for use by a storage mechanism for section components.
297 * 296 *
298 * @return array 297 * @return array
299 * An array representation of the section component. 298 * An array representation of the section component.
300 */ 299 */
301 public function toArray() { 300 public function toArray() {
306 'additional' => $this->additional, 305 'additional' => $this->additional,
307 'weight' => $this->getWeight(), 306 'weight' => $this->getWeight(),
308 ]; 307 ];
309 } 308 }
310 309
310 /**
311 * Creates an object from an array representation of the section component.
312 *
313 * Only use this method if you are implementing custom storage for sections.
314 *
315 * @param array $component
316 * An array of section component data in the format returned by ::toArray().
317 *
318 * @return static
319 * The section component object.
320 */
321 public static function fromArray(array $component) {
322 return (new static(
323 $component['uuid'],
324 $component['region'],
325 $component['configuration'],
326 $component['additional']
327 ))->setWeight($component['weight']);
328 }
329
311 } 330 }