Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $bodyBlocks = [];
- foreach ($entry->getFieldValue('pageBuilder')->all() as $block){
- switch ($block->type->handle) {
- case 'blockText':
- $bodyBlocks[] = $block->blockTextContent;
- break;
- }
- }
- // Begin defining the response data for this entry
- $data = [
- 'title' => $entry->title,
- 'slug' => $entry->url,
- 'status' => $entry->status,
- 'textArea' => $bodyBlocks
- ];
- "title": "Title Here",
- "slug": "slug-here",
- "status": "live",
- "textArea": [
- "<p>Text from first 1st block</p>",
- "<p>Text from first 2nd block</p>",
- "<p>Text from first 3rd block</p>",
- ],
- "heroBanner": "img.jpg",
- "title": "Title Here",
- "slug": "slug-here",
- "status": "live",
- "textArea": [
- "<p>Text from first 1st block</p> <p>Text from first 2nd block</p> <p>Text from first 3rd block</p>",
- ],
- "heroBanner": "img.jpg",
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement