Skip to content

Commit 0ffe018

Browse files
committed
remove default and required for folder
1 parent 247c5b8 commit 0ffe018

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ public function apply_default_transformations( array $transformations, $type = '
509509
$default['quality'] = 'auto';
510510
}
511511
}
512-
$default = array_filter( $default ); // Clear out empty settings.
512+
$default = array_filter( $default ); // Clear out empty settings.
513513
$new_transformations['qf'] = \Cloudinary\Connect\Api::generate_transformation_string( array( $default ), $type );
514514
// Add freeform global transformations.
515515
$freeform_type = $type . '_freeform';
@@ -892,7 +892,6 @@ public function editor_assets() {
892892
'api_key' => $this->credentials['api_key'],
893893
'cms_type' => 'wordpress',
894894
'remove_header' => true,
895-
'folder' => array( 'path' => $this->cloudinary_folder ),
896895
'integration' => array(
897896
'type' => 'wordpress_plugin',
898897
'platform' => 'WordPress ' . get_bloginfo( 'version' ),
@@ -901,6 +900,11 @@ public function editor_assets() {
901900
),
902901
);
903902

903+
// Set folder if needed.
904+
if ( !empty( $this->cloudinary_folder ) ) {
905+
$params['mloptions']['folder'] = array( 'path' => $this->cloudinary_folder );
906+
}
907+
904908
$params['mloptions']['insert_transformation'] = true;
905909
$params['mloptions']['inline_container'] = '#cloudinary-dam';
906910

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-sync-media.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
'fields' => array(
1616
'cloudinary_folder' => array(
1717
'label' => __( 'Cloudinary folder path', 'cloudinary' ),
18-
'description' => __( 'Specify the folder in your Cloudinary account where WordPress assets are uploaded to. All assets uploaded to WordPress from this point on will be synced to the specified folder in Cloudinary.', 'cloudinary' ),
19-
'default' => '/',
18+
'description' => __( 'Specify the folder in your Cloudinary account where WordPress assets are uploaded to. All assets uploaded to WordPress from this point on will be synced to the specified folder in Cloudinary. Leave blank to use the root of your Cloudinary library.', 'cloudinary' ),
2019
'sanitize_callback' => array( '\Cloudinary\Media', 'sanitize_cloudinary_folder' ),
21-
'required' => true,
2220
'suffix' => '<button type="submit" class="button button-primary">' . __( 'Save folder settings', 'cloudinary' ) . '</button>',
2321
),
2422
),

0 commit comments

Comments
 (0)