瀏覽代碼

:recycle: attaching the whole block for the galleries object

tags/0.9.0
J 5 年之前
父節點
當前提交
aca1022d5a

+ 15
- 15
plugins/cia-endpoints/includes/class.make-endpoint.php 查看文件

54
     private function _getAttachments($item, $galleries) {
54
     private function _getAttachments($item, $galleries) {
55
         // Get media
55
         // Get media
56
         $desiredSizes = ['thumbnail', 'medium', 'large', 'full'];
56
         $desiredSizes = ['thumbnail', 'medium', 'large', 'full'];
57
-		$all_image_ids_in_gallery = array();
58
-		$all_image_ids = array();
59
-		foreach ($galleries as $gallery) {
60
-			array_push($all_image_ids_in_gallery, $gallery[ids]);
57
+        $all_image_ids_in_gallery = array();
58
+        $all_image_ids = array();
59
+        foreach ($galleries as $gallery) {
60
+            array_push($all_image_ids_in_gallery, $gallery[ids]);
61
         }
61
         }
62
-		foreach ($all_image_ids_in_gallery as $ids) {
63
-			foreach ($ids as $id) {
64
-				array_push($all_image_ids, $id);
65
-			}
66
-		}
67
-		$attachment_map = array();
68
-		foreach ($all_image_ids as $id) {
69
-			$imageSizes = array();
62
+        foreach ($all_image_ids_in_gallery as $ids) {
63
+            foreach ($ids as $id) {
64
+                array_push($all_image_ids, $id);
65
+            }
66
+        }
67
+        $attachment_map = array();
68
+        foreach ($all_image_ids as $id) {
69
+            $imageSizes = array();
70
             foreach ($desiredSizes as $size) {	
70
             foreach ($desiredSizes as $size) {	
71
                 $imageSizes[$size] = wp_get_attachment_image_url($id, $size);
71
                 $imageSizes[$size] = wp_get_attachment_image_url($id, $size);
72
-			}
72
+            }
73
             // store size:url map under image id
73
             // store size:url map under image id
74
-			$attachment_map[$id] = $imageSizes;
74
+            $attachment_map[$id] = $imageSizes;
75
         }
75
         }
76
-    	return $attachment_map;
76
+        return $attachment_map;
77
     }
77
     }
78
 
78
 
79
     public function prepare_item_for_response( $args ) {
79
     public function prepare_item_for_response( $args ) {

+ 1
- 1
plugins/cia-endpoints/includes/reformat-blocks.php 查看文件

23
         $parsed_blocks = array();
23
         $parsed_blocks = array();
24
         foreach ($blocks as $block) {
24
         foreach ($blocks as $block) {
25
             if($block[blockName] === "core/gallery") {
25
             if($block[blockName] === "core/gallery") {
26
-                array_push($parsed_blocks, $block[attrs]);
26
+                array_push($parsed_blocks, $block);
27
             }
27
             }
28
         }
28
         }
29
         return $parsed_blocks;
29
         return $parsed_blocks;

Loading…
取消
儲存