data = $data; } /** * Convert legacy data such as layout information. * * @return object $data */ public function convert(): object { $dataVersion = '0.0.0'; $data = $this->data; if (!empty($data->automadVersion)) { $dataVersion = $data->automadVersion; } if (version_compare($dataVersion, $this->targetVersion, '>=')) { return $data; } Debug::log($dataVersion, 'Converting legacy block data'); $data = $this->convertLayout($data); $data = $this->convertLists($data); return $data; } /** * Convert legacy layout properties to new tune api. * * @param object $data * @return object $data */ private function convertLayout(object $data): object { foreach ($data->blocks as $block) { if (!isset($block->tunes)) { $block->tunes = (object) array('layout' => (object) array()); if (!empty($block->data->widthFraction)) { $block->tunes->layout->width = $block->data->widthFraction; } if (isset($block->data->stretched)) { $block->tunes->layout->stretched = $block->data->stretched; } } } return $data; } /** * Convert legacy lists to new nested lists. * * @param object $data * @return object $data */ private function convertLists(object $data): object { foreach ($data->blocks as $block) { if ($block->type == 'lists') { $block->data->items = (object) array_map(function ($item) { if (is_string($item)) { return (object) array( 'content' => $item, 'items' => (object) array()); } return $item; }, (array) $block->data->items); } } return $data; } } __halt_compiler();----SIGNATURE:----JOOxKk+CrFHs9kFCQxHESioGr4e8VqMvSjR66LHqB9+w6bX8SwWHIHzBYHoiatGlw1UXb3G5lSfNuUx0Mj9+CdPGBwHcn1QRNR6MDX46GCsl6ZKcZJE7bOfBqp5/qpQD0w4BAHFjMG9BBHj4tfcF1zspQw0YbzzM8n/0xDCzbHjVhTGm3AqiI/GoR1C9K6+cwai4QcFXtRPSpAeRvG3XgEh2U4fz014Ydb0O3SxIvWV13NJstOZ+rGtiqE95YjWiGR3C6FQYcDYPb5mY+v8jQCkYrcnLpsuvHlWuqRMpkPnQDRCYF290mQKD37tmsh8DjGJQ/v/8ICFowml9bp2/pxbmZmrYi+Vqf+cmdXIYAJNElil+tZqNd1xmtBTtTktcp4kI/xhyPxeJkUSLtT4pQfjWYFRfos+aeZrYXn4fS4Z6ECwyKlz0x5fhp7/ozSJqa4iN7+axzLjj1rK4SibcIengQ/mqLIjN3AyQxDuj1va9JHxB1fG/qbQ6u2culVmEXLwumZN+IPzFzUc0fWF6YKztQ1TFP862Bkvru/UxeU/LYA4DXTfZ/SkV7vlnkmsS65LszM4VRJvyVUyRVxy9b2wmuqfjzPQpYSCcsJeviCeZo10FDGviWEe4wGBX1ojRTASc3DGRlP8rNAz8y6nNtrVJt0zmVAD98xeTU5ubCzs=----ATTACHMENT:----NzM2Mzc2NzU0Mzc3MDUzOCAyMjI2NDkwNTc2NTAyNDg4IDk1MjMwNTA5NzE4NDE4MDM=