Changeset 1365

Show
Ignore:
Timestamp:
02/13/08 18:53:48 (5 months ago)
Author:
mpaschal
Message:

Convert archive types specified purely in the registry into archive type objects when types are initialized

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/release-29/lib/MT/WeblogPublisher.pm

    r1364 r1365  
    4545sub init_archive_types { 
    4646    my $types = MT->registry("archive_types") || {}; 
    47     $ArchiveTypes{$_} = $types->{$_} for keys %$types; 
     47    my $mt = MT->instance; 
     48    while (my ($type, $typedata) = each %$types) { 
     49        if ('HASH' eq ref $typedata) { 
     50            $typedata = { %$typedata };  # don't edit registry 
     51            $typedata->{$_} = $mt->handler_to_coderef($typedata->{$_}) 
     52                for qw( archive_label archive_file archive_title date_range 
     53                        archive_group_iter archive_group_entries 
     54                        archive_entries_count ); 
     55            $typedata->{default_archive_templates} = [ 
     56                map { ArchiveFileTemplate(%$_) } 
     57                    @{ $typedata->{default_archive_templates} || [] } 
     58            ]; 
     59            $typedata = ArchiveType(%$typedata); 
     60        } 
     61        $ArchiveTypes{$type} = $typedata; 
     62    } 
    4863} 
    4964