Skip to content

Commit 0568a4f

Browse files
authored
Merge pull request #1014 from cloudinary/fix-pattern-block-save-transforms
Block patterns editor issue
2 parents 145674c + 799210d commit 0568a4f

File tree

1 file changed

+6
-43
lines changed

1 file changed

+6
-43
lines changed

php/class-delivery.php

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -178,49 +178,7 @@ public function maybe_unset_attributes( $response, $handler, $request ) {
178178
&& 'edit' === $request->get_param( 'context' )
179179
)
180180
) {
181-
// This has a priority of 10 so can be overridden by other filters.
182-
add_filter(
183-
'cloudinary_unset_attributes',
184-
'__return_true'
185-
);
186-
187-
add_filter(
188-
'cloudinary_apply_breakpoints',
189-
'__return_false'
190-
);
191-
192-
add_filter(
193-
'cloudinary_parse_element',
194-
static function ( $tag_element ) {
195-
$tag_element['breakpoints'] = false;
196-
return $tag_element;
197-
}
198-
);
199-
200-
add_filter(
201-
'cloudinary_skip_responsive_breakpoints',
202-
'__return_true'
203-
);
204-
205-
if ( false === strpos( $route, 'wp/v2/blocks/' ) ) {
206-
add_filter(
207-
'cloudinary_tag_skip_classes',
208-
function ( $skip, $tag_element ) {
209-
// Bail on additional assets.
210-
return $this->plugin->get_component( 'assets' )->is_asset( $tag_element['atts']['src'] );
211-
},
212-
10,
213-
2
214-
);
215-
216-
add_filter(
217-
'cloudinary_parse_element',
218-
function ( $element ) {
219-
unset( $element['atts']['class'] );
220-
return $element;
221-
}
222-
);
223-
}
181+
add_filter( 'cloudinary_skip_parse_element', '__return_true' );
224182
}
225183
}
226184

@@ -1440,6 +1398,11 @@ public function rebuild_tag( $tag_element ) {
14401398
* @return array|null
14411399
*/
14421400
public function parse_element( $element ) {
1401+
1402+
if ( apply_filters( 'cloudinary_skip_parse_element', false, $element ) ) {
1403+
return null;
1404+
}
1405+
14431406
static $post_context = 0;
14441407

14451408
$config = $this->plugin->settings->get_value( 'image_settings' );

0 commit comments

Comments
 (0)