Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. $bodyBlocks = [];
  2. foreach ($entry->getFieldValue('pageBuilder')->all() as $block){
  3. switch ($block->type->handle) {
  4. case 'blockText':
  5. $bodyBlocks[] = $block->blockTextContent;
  6. break;
  7. }
  8. }
  9.  
  10. // Begin defining the response data for this entry
  11. $data = [
  12. 'title' => $entry->title,
  13. 'slug' => $entry->url,
  14. 'status' => $entry->status,
  15. 'textArea' => $bodyBlocks
  16. ];
  17.  
  18. "title": "Title Here",
  19. "slug": "slug-here",
  20. "status": "live",
  21. "textArea": [
  22. "<p>Text from first 1st block</p>",
  23. "<p>Text from first 2nd block</p>",
  24. "<p>Text from first 3rd block</p>",
  25. ],
  26. "heroBanner": "img.jpg",
  27.  
  28. "title": "Title Here",
  29. "slug": "slug-here",
  30. "status": "live",
  31. "textArea": [
  32. "<p>Text from first 1st block</p> <p>Text from first 2nd block</p> <p>Text from first 3rd block</p>",
  33. ],
  34. "heroBanner": "img.jpg",
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement