Merge pull request #367 from alexonweb/master

Modification Pages Plugin
This commit is contained in:
Diego Najar 2016-11-30 14:19:59 -03:00 committed by GitHub
commit e1e612bfb0
3 changed files with 31 additions and 18 deletions

View File

@ -6,5 +6,6 @@
},
"home": "Home",
"show-home-link": "Show home link"
"show-home-link": "Show home link",
"show-children": "Show children"
}

View File

@ -6,5 +6,6 @@
},
"home": "Главная",
"show-home-link": "Показывать ссылку на главную"
"show-home-link": "Показывать ссылку на главную",
"show-children": "Показывать подменю"
}

View File

@ -6,6 +6,7 @@ class pluginPages extends Plugin {
{
$this->dbFields = array(
'homeLink'=>1,
'children'=>1,
'label'=>'Pages'
);
}
@ -25,6 +26,12 @@ class pluginPages extends Plugin {
$html .= '<label class="forCheckbox" for="jshomeLink">'.$Language->get('Show home link').'</label>';
$html .= '</div>';
$html .= '<div>';
$html .= '<input type="hidden" name="children" value="0">';
$html .= '<input name="children" id="children" type="checkbox" value="1" '.($this->getDbField('children')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jschildren">'.$Language->get('Show children').'</label>';
$html .= '</div>';
return $html;
}
@ -62,6 +69,9 @@ class pluginPages extends Plugin {
$html .= '<li class="parent">';
$html .= '<a class="parent'.( ($parent->key()==$Url->slug())?' active':'').'" href="'.$parent->permalink().'">'.$parent->title().'</a>';
// Show children elements?
if($this->getDbField('children')) {
// Check if the parent has children
if(isset($pagesParents[$parent->key()]))
{
@ -81,6 +91,7 @@ class pluginPages extends Plugin {
}
$html .= '</ul>';
}
}
$html .= '</li>';
}