@@ -116,10 +116,11 @@ public static function update_transformations_overlay( $attachment_id, $overlay_
116116 *
117117 * @param int $attachment_id The attachment ID.
118118 * @param bool $as_string Set the output to a string.
119+ * @param bool $free_transformations_only If true, only return the base transformations without overlays.
119120 *
120121 * @return array|string
121122 */
122- public static function get_transformations ( $ attachment_id , $ as_string = false ) {
123+ public static function get_transformations ( $ attachment_id , $ as_string = false , $ free_transformations_only = false ) {
123124 static $ media , $ cache = array ();
124125 if ( ! $ media ) {
125126 $ media = get_plugin_instance ()->get_component ( 'media ' );
@@ -136,12 +137,14 @@ public static function get_transformations( $attachment_id, $as_string = false )
136137 $ relationship = Relationship::get_relationship ( $ attachment_id );
137138 $ transformations = $ relationship ->transformations ;
138139
139- $ text_overlay = self ::get_overlay ( $ attachment_id , 'text_overlay ' );
140- $ image_overlay = self ::get_overlay ( $ attachment_id , 'image_overlay ' );
140+ if ( ! $ free_transformations_only ) {
141+ $ text_overlay = self ::get_overlay ( $ attachment_id , 'text_overlay ' );
142+ $ image_overlay = self ::get_overlay ( $ attachment_id , 'image_overlay ' );
141143
142- // Merge transformations with overlays.
143- $ parts = array_filter ( array ( $ transformations , $ image_overlay , $ text_overlay ) );
144- $ transformations = ! empty ( $ parts ) ? implode ( '/ ' , $ parts ) : '' ;
144+ // Merge transformations with overlays.
145+ $ parts = array_filter ( array ( $ transformations , $ image_overlay , $ text_overlay ) );
146+ $ transformations = ! empty ( $ parts ) ? implode ( '/ ' , $ parts ) : '' ;
147+ }
145148
146149 if ( ! $ as_string ) {
147150 $ transformations = ! empty ( $ transformations ) ? $ media ->get_transformations_from_string ( $ transformations , $ relationship ->asset_type ) : array ();
0 commit comments