SF Feature #3294932 - Hiding not used templates

This commit is contained in:
Deon George
2011-05-03 20:49:16 +10:00
parent 3919825000
commit a2828b2cf0
3 changed files with 17 additions and 1 deletions

View File

@@ -198,9 +198,13 @@ abstract class xmlTemplates {
# Clone this, as we'll disable some templates, as a result of the container being requested.
$template = clone $details;
if (! is_null($container) && ($regexp = $template->getRegExp()) && (! @preg_match('/'.$regexp.'/i',$container)))
if (! is_null($container) && ($regexp = $template->getRegExp()) && (! @preg_match('/'.$regexp.'/i',$container))) {
$template->setInvalid(_('This template is not valid in this container'),true);
if ($_SESSION[APPCONFIG]->getValue('appearance','hide_template_regexp'))
$template->setInvisible();
}
if ($template->isVisible() && (! $disabled || ! $template->isAdminDisabled()))
if (is_null($type) || (! is_null($type) && $template->isType($type)))
array_push($result,$template);