@@ -2,9 +2,9 @@ import { EntryModel } from "."
22
33 export function addTags ( entry : EntryModel , contentTypeUid : string , tagsAsObject : boolean , locale : string = 'en-us' ) : void {
44 if ( entry ) {
5- const appliedVariants = entry . _applied_variants || null ;
6- entry . $ = getTag ( entry , `${ contentTypeUid } .${ entry . uid } .${ locale } ` , tagsAsObject , locale , { _applied_variants : appliedVariants , shouldApplyVariant : ! ! appliedVariants , metaKey : '' } ) }
7- }
5+ const appliedVariants = entry . _applied_variants || entry ?. system ?. applied_variants || null ;
6+ entry . $ = getTag ( entry , `${ contentTypeUid } .${ entry . uid } .${ locale } ` , tagsAsObject , locale , { _applied_variants : appliedVariants , shouldApplyVariant : ! ! appliedVariants , metaKey : '' } ) }
7+ }
88
99 function getTag ( content : object , prefix : string , tagsAsObject : boolean , locale : string , appliedVariants : { _applied_variants :{ [ key : string ] : any } , shouldApplyVariant : boolean , metaKey : string } ) : object {
1010 const tags : any = { }
@@ -48,7 +48,7 @@ import { EntryModel } from "."
4848 * }]
4949 * }
5050 */
51- const newAppliedVariants = obj . _applied_variants || _applied_variants ;
51+ const newAppliedVariants = obj . _applied_variants || obj ?. system ?. applied_variants || _applied_variants ;
5252 const newShouldApplyVariant = ! ! newAppliedVariants
5353 value [ index ] . $ = getTag ( obj , `${ obj . _content_type_uid } .${ obj . uid } .${ obj . locale || locale } ` , tagsAsObject , locale , { _applied_variants :newAppliedVariants , shouldApplyVariant :newShouldApplyVariant , metaKey : "" } )
5454 } else if ( typeof obj === "object" ) {
0 commit comments