Skip to content

Commit

Permalink
Adding a comment about the processing of templates in template sets m…
Browse files Browse the repository at this point in the history
…aking it clear why a template is defined with a value in either the text or widgets attributes but not both. Totally not obvious how the widgets and text attributes are exclusive and related via MT::Template translation later in the process.
  • Loading branch information
jayallen committed Jul 15, 2009
1 parent 43ab76b commit cb2854a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/MT/DefaultTemplates.pm
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@ sub templates {
$tmpl->{key} = $tmpl_id;
$tmpl->{identifier} = $tmpl_id;

# Even though they are stored as templates, widgetsets
# are special. They don't have a "text" attribute value
# but instead an array of associated widgets which are
# later translated into template includes and stored
# in the "text" attribute.
if ( exists $tmpl->{widgets} ) {
my $widgets = $tmpl->{widgets};
my @widgets;
Expand All @@ -370,6 +375,8 @@ sub templates {
}
}
$tmpl->{widgets} = \@widgets if @widgets;
# All NON-widgetsets are processed by the block below
# and are defined with the common "text" attribute.
} else {
# load template if it hasn't been loaded already
if (!exists $tmpl->{text}) {
Expand Down

0 comments on commit cb2854a

Please sign in to comment.