Skip to content

Commit 799210d

Browse files
committed
alternative approach: apply no filters in block editor requests
1 parent c67ffae commit 799210d

File tree

1 file changed

+6
-52
lines changed

1 file changed

+6
-52
lines changed

php/class-delivery.php

Lines changed: 6 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -178,58 +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-
add_filter(
206-
'cloudinary_prepare_size',
207-
function ( $size ) {
208-
unset( $size['transformation'] );
209-
return $size;
210-
}
211-
);
212-
213-
// This is for patterns only, not for patterns in posts.
214-
if ( false === strpos( $route, 'wp/v2/blocks/' ) ) {
215-
add_filter(
216-
'cloudinary_tag_skip_classes',
217-
function ( $skip, $tag_element ) {
218-
// Bail on additional assets.
219-
return $this->plugin->get_component( 'assets' )->is_asset( $tag_element['atts']['src'] );
220-
},
221-
10,
222-
2
223-
);
224-
225-
add_filter(
226-
'cloudinary_parse_element',
227-
function ( $element ) {
228-
unset( $element['atts']['class'] );
229-
return $element;
230-
}
231-
);
232-
}
181+
add_filter( 'cloudinary_skip_parse_element', '__return_true' );
233182
}
234183
}
235184

@@ -1449,6 +1398,11 @@ public function rebuild_tag( $tag_element ) {
14491398
* @return array|null
14501399
*/
14511400
public function parse_element( $element ) {
1401+
1402+
if ( apply_filters( 'cloudinary_skip_parse_element', false, $element ) ) {
1403+
return null;
1404+
}
1405+
14521406
static $post_context = 0;
14531407

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

0 commit comments

Comments
 (0)