Skip to content

Conversation

@DavidCramer
Copy link
Contributor

No description provided.

Copy link
Contributor

@pereirinha pereirinha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidCramer

Left you some comments.

Thanks

*
* @return array
*/
$transformations = apply_filters( 'cloudinary_transformations', $transformations, $attachment_id );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidCramer

What do you think if we move this filter just before we return? We would need to use $overwrite_transformations, but it would give us more control.

As a general rule, I like to see filters either early on or the latest possible.

public function apply_default_transformations( array $transformations, $type = 'image' ) {

// Allow filter to bypass defaults.
if ( false === apply_filters( 'cloudinary_apply_default_transformations', true ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidCramer

What do you think if we send the $attachement_id to apply_default_transformations() and use it in this filter to have more granular control on this bypass?

Copy link
Contributor

@pereirinha pereirinha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidCramer

I left you a few minor comments.

public function apply_default_transformations( array $transformations, $attachment_id ) {
// Allow filter to bypass defaults.
if ( false === apply_filters( 'cloudinary_apply_default_transformations', true ) ) {
if ( false === apply_filters( 'cloudinary_apply_default_transformations', true, $attachment_id ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidCramer Can we add documentation here to this filter?

unset( $attributes['poster'] );
}
// Add the player version to use.
$params['vpv'] = '1.5.1';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidCramer

Couldn't we use here PLAYER_VER instead?

$transformations = $this->get_transformations_from_string( $asset['url'] );
if ( ! empty( $transformations ) ) {
$asset['sync_key'] .= wp_json_encode( $transformations );
$asset['sync_key'] .= wp_json_encode( $transformations );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidCramer do you want to fix this alignment? :)

Copy link
Contributor

@pereirinha pereirinha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great.

Thank you.

@pereirinha pereirinha merged commit 0547a87 into develop Feb 17, 2021
@pereirinha pereirinha deleted the fix/video-scripts-present branch March 16, 2021 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants