Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.7.5
-
None
Description
custom field is an open XML element, that Velocity has to traverse to find expected data: on each traversal, a test has to be added.
That leads to code like in Fluido skin:
#if ( $decoration.custom.getChild( 'fluidoSkin' ) && $decoration.custom.getChild( 'fluidoSkin' ).getChild( 'skipGenerationDate' ) && $decoration.custom.getChild( 'fluidoSkin' ).getChild( 'skipGenerationDate' ).getValue() == 'true' )
or
#if ( $decoration.custom.getChild('fluidoSkin') && $decoration.custom.getChild( 'fluidoSkin' ).getChild( 'navBarStyle' ) ) #set ( $navBarStyle = $decoration.custom.getChild( 'fluidoSkin' ).getChild( 'navBarStyle' ).getValue() )
or
#if ( $decoration.custom.getChild( 'fluidoSkin' ).getChild( 'breadcrumbDivider' ) ) #set ( $breadcrumbDivider = $decoration.custom.getChild( 'fluidoSkin' ).getChild( 'breadcrumbDivider' ).getValue() ) #else #set ( $breadcrumbDivider = '/' ) #end
Adding 3 methods to decoration:
- getCustomChild( "fluidoSkin.navBarStyle" )
- getCustomChildValue( "fluidoSkin.navBarStyle" )
- getCustomChildValue( "fluidoSkin.breadcrumbDivider", "/" )
would permit to simplify:
#if ( $decoration.getCustomChildValue( 'fluidoSkin.skipGenerationDate' ) == 'true' )
and
#if ( $decoration.getCustomChild('fluidoSkin.navBarStyle' ) ) #set ( $navBarStyle = $decoration.getCustomChild('fluidoSkin.navBarStyle' ).getValue() )
and
#set ( $breadcrumbDivider = $decoration.getCustomValue( 'fluidoSkin.breadcrumbDivider', '/' ) )
Attachments
Issue Links
- is depended upon by
-
MSKINS-141 simplify custom skin configuration code
- Closed