Changeset 2496

Show
Ignore:
Timestamp:
06/03/08 22:02:56 (21 months ago)
Author:
bchoate
Message:

Fix to permit plugins that prepopulate the entries stash to call the entries handler allowing for further filtering using category/tag/author attributes. BugId:80022

Location:
branches/release-39
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/release-39/lib/MT/Template/ContextHandlers.pm

    r2464 r2496  
    75387538        $entries = undef if $entry->class ne $class_type; 
    75397539 
    7540         foreach my $args_key ('category', 'categories', 'tag', 'tags', 'author', 'id', 'days', 'recently_commented_on', 'include_subcategories', 'include_blogs', 'exclude_blogs', 'blog_ids') { 
    7541             if (exists($args->{$args_key})) { 
    7542                 $entries = undef; 
    7543                 last; 
     7540        # For the stock Entries/Pages tags, clear any prepopulated 
     7541        # entries list (placed by archive publishing) if we're invoked 
     7542        # with any of the following attributes. A plugin tag may 
     7543        # prepopulate the entries stash and then invoke this handler 
     7544        # to permit further filtering of the entries. 
     7545        my $tag = lc $ctx->stash('tag'); 
     7546        if ($entries && (($tag eq 'entries') || ($tag eq 'pages'))) { 
     7547            foreach my $args_key ('category', 'categories', 'tag', 'tags', 
     7548                'author') { 
     7549                if (exists($args->{$args_key})) { 
     7550                    $entries = undef; 
     7551                    last; 
     7552                } 
     7553            } 
     7554        } 
     7555        if ( $entries ) { 
     7556            foreach my $args_key ('id', 'days', 'recently_commented_on', 
     7557                'include_subcategories', 'include_blogs', 'exclude_blogs', 
     7558                'blog_ids') { 
     7559                if (exists($args->{$args_key})) { 
     7560                    $entries = undef; 
     7561                    last; 
     7562                } 
    75447563            } 
    75457564        } 
  • branches/release-39/php/lib/block.mtentries.php

    r2294 r2496  
    1717        // break that context, clear the stashed entries so fetch_entries 
    1818        // can reselect. 
    19         if ($ctx->stash('entries') && 
    20             (isset($args['category']) || isset($args['categories']) || 
    21              isset($args['tag']) || isset($args['tags']) || 
    22              isset($args['id']) || 
    23              isset($args['author']) || 
     19        $this_tag = strtolower($ctx->this_tag()); 
     20        if (($this_tag == 'mtentries') || ($this_tag == 'mtpages')) { 
     21            if ($ctx->stash('entries') && 
     22                (isset($args['category']) || isset($args['categories']) || 
     23                 isset($args['tag']) || isset($args['tags']) || 
     24                 isset($args['author']) )) 
     25                $ctx->__stash['entries'] = null; 
     26        } 
     27        if ($ctx->__stash['entries'] && 
     28            (isset($args['id']) || 
    2429             isset($args['recently_commented_on']) || 
    2530             isset($args['include_subcategories']) || 
  • branches/release-39/php/lib/block.mtpages.php

    r1335 r2496  
    4747    return $out; 
    4848} 
    49 ?>