Merge pull request #367 from alexonweb/master
Modification Pages Plugin
This commit is contained in:
commit
e1e612bfb0
|
@ -6,5 +6,6 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"home": "Home",
|
"home": "Home",
|
||||||
"show-home-link": "Show home link"
|
"show-home-link": "Show home link",
|
||||||
}
|
"show-children": "Show children"
|
||||||
|
}
|
||||||
|
|
|
@ -6,5 +6,6 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"home": "Главная",
|
"home": "Главная",
|
||||||
"show-home-link": "Показывать ссылку на главную"
|
"show-home-link": "Показывать ссылку на главную",
|
||||||
|
"show-children": "Показывать подменю"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ class pluginPages extends Plugin {
|
||||||
{
|
{
|
||||||
$this->dbFields = array(
|
$this->dbFields = array(
|
||||||
'homeLink'=>1,
|
'homeLink'=>1,
|
||||||
|
'children'=>1,
|
||||||
'label'=>'Pages'
|
'label'=>'Pages'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -24,6 +25,12 @@ class pluginPages extends Plugin {
|
||||||
$html .= '<input name="homeLink" id="jshomeLink" type="checkbox" value="1" '.($this->getDbField('homeLink')?'checked':'').'>';
|
$html .= '<input name="homeLink" id="jshomeLink" type="checkbox" value="1" '.($this->getDbField('homeLink')?'checked':'').'>';
|
||||||
$html .= '<label class="forCheckbox" for="jshomeLink">'.$Language->get('Show home link').'</label>';
|
$html .= '<label class="forCheckbox" for="jshomeLink">'.$Language->get('Show home link').'</label>';
|
||||||
$html .= '</div>';
|
$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;
|
return $html;
|
||||||
}
|
}
|
||||||
|
@ -62,25 +69,29 @@ class pluginPages extends Plugin {
|
||||||
$html .= '<li class="parent">';
|
$html .= '<li class="parent">';
|
||||||
$html .= '<a class="parent'.( ($parent->key()==$Url->slug())?' active':'').'" href="'.$parent->permalink().'">'.$parent->title().'</a>';
|
$html .= '<a class="parent'.( ($parent->key()==$Url->slug())?' active':'').'" href="'.$parent->permalink().'">'.$parent->title().'</a>';
|
||||||
|
|
||||||
// Check if the parent has children
|
// Show children elements?
|
||||||
if(isset($pagesParents[$parent->key()]))
|
if($this->getDbField('children')) {
|
||||||
{
|
|
||||||
$children = $pagesParents[$parent->key()];
|
|
||||||
|
|
||||||
// Print children
|
// Check if the parent has children
|
||||||
$html .= '<ul class="children">';
|
if(isset($pagesParents[$parent->key()]))
|
||||||
foreach($children as $child)
|
|
||||||
{
|
{
|
||||||
// Check if the child is published
|
$children = $pagesParents[$parent->key()];
|
||||||
if( $child->published() )
|
|
||||||
|
// Print children
|
||||||
|
$html .= '<ul class="children">';
|
||||||
|
foreach($children as $child)
|
||||||
{
|
{
|
||||||
$html .= '<li class="child">';
|
// Check if the child is published
|
||||||
$html .= '<a class="'.( ($child->key()==$Url->slug())?' active':'').'" href="'.$child->permalink().'">'.$child->title().'</a>';
|
if( $child->published() )
|
||||||
$html .= '</li>';
|
{
|
||||||
|
$html .= '<li class="child">';
|
||||||
|
$html .= '<a class="'.( ($child->key()==$Url->slug())?' active':'').'" href="'.$child->permalink().'">'.$child->title().'</a>';
|
||||||
|
$html .= '</li>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$html .= '</ul>';
|
||||||
}
|
}
|
||||||
$html .= '</ul>';
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$html .= '</li>';
|
$html .= '</li>';
|
||||||
}
|
}
|
||||||
|
@ -92,4 +103,4 @@ class pluginPages extends Plugin {
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue