Created
February 17, 2013 21:01
-
-
Save airways/4973441 to your computer and use it in GitHub Desktop.
Calling {exp:structure:entries} with a parent_id parameter that does not have any children results in all entries from the site tree being returned, instead of nothing, which is what I would expect. This patch fixes this by setting the entry_id parameter to an impossible value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function entries() { | |
$parent_id = $this->EE->TMPL->fetch_param('parent_id', false); | |
if ($parent_id) { | |
$child_ids = $this->sql->get_child_entries($parent_id); | |
$fixed_order = $child_ids !== FALSE && count($child_ids > 0) ? implode('|', $child_ids) : false; | |
if ($fixed_order) { | |
$this->EE->TMPL->tagparams['fixed_order'] = $fixed_order; | |
} else { | |
$this->EE->TMPL->tagparams['entry_id'] = '-99999'; | |
} | |
} | |
return parent::entries(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice catch man!