Skip to content

Commit 1ed2acf

Browse files
authored
Merge pull request #736 from cloudinary/fix/breakpoints-in-admin
active and enabled
2 parents d2a6961 + e7a0958 commit 1ed2acf

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

php/class-delivery-feature.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function enqueue_assets() {
166166
* @return bool
167167
*/
168168
public function is_enabled() {
169-
return 'on' === $this->config[ $this->enable_slug ];
169+
return $this->is_active() && 'on' === $this->config[ $this->enable_slug ];
170170
}
171171

172172
/**

php/class-delivery.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -890,9 +890,11 @@ public function convert_tags( $content, $context = 'view' ) {
890890
if ( empty( $relation['public_id'] || $url === $relation['public_id'] ) ) {
891891
continue; // We don't need the public_id relation item.
892892
}
893-
$base = $type . ':' . $url;
894-
$public_id = ! is_admin() ? $relation['public_id'] . '.' . $relation['format'] : null;
895-
$aliases[ $base ] = $this->media->cloudinary_url( $relation['post_id'], array(), $relation['transformations'], $public_id );
893+
$base = $type . ':' . $url;
894+
$public_id = ! is_admin() ? $relation['public_id'] . '.' . $relation['format'] : null;
895+
$cloudinary_url = $this->media->cloudinary_url( $relation['post_id'], array(), $relation['transformations'], $public_id );
896+
$aliases[ $base . '?' ] = $cloudinary_url . '&';
897+
$aliases[ $base ] = $cloudinary_url;
896898
}
897899

898900
// Create the sized found relations second.
@@ -909,7 +911,9 @@ public function convert_tags( $content, $context = 'view' ) {
909911
$aliases[ $local_url ] = $cached[ $local_url ];
910912
continue;
911913
}
912-
$aliases[ $local_url ] = $this->media->cloudinary_url( $relation['post_id'], explode( 'x', $size ), $relation['transformations'], $public_id );
914+
$cloudinary_url = $this->media->cloudinary_url( $relation['post_id'], explode( 'x', $size ), $relation['transformations'], $public_id );
915+
$aliases[ $local_url . '?' ] = $cloudinary_url . '&';
916+
$aliases[ $local_url ] = $cloudinary_url;
913917
}
914918
}
915919

php/class-svg.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,16 @@ public function maybe_setup_metadata( $attachment_id, $result ) {
207207
}
208208
}
209209

210+
/**
211+
* Check if component is active.
212+
*
213+
* @return bool
214+
*/
215+
public function is_active() {
216+
// It's always active if on.
217+
return 'on' === $this->config[ $this->enable_slug ];
218+
}
219+
210220
/**
211221
* Setup the component
212222
*/

0 commit comments

Comments
 (0)