mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-06 19:46:44 +02:00
Merge branch 'develop' into feature/translate-admin
This commit is contained in:
@@ -181,7 +181,6 @@ class Admin
|
||||
|
||||
$this->setMessage($this->translate('PLUGIN_ADMIN.LOGIN_LOGGED_IN'), 'info');
|
||||
|
||||
// $redirect_route =$this->getLoginRedirect() ?: $this->uri->route();
|
||||
$redirect_route = $this->uri->route();
|
||||
$grav->redirect($redirect_route);
|
||||
}
|
||||
@@ -557,9 +556,23 @@ class Admin
|
||||
if (isset($this->session->{$page->route()})) {
|
||||
// Found the type and header from the session.
|
||||
$data = $this->session->{$page->route()};
|
||||
$visible = isset($data['visible']) && $data['visible'] != '' ? (bool)$data['visible'] : $this->guessVisibility($page);
|
||||
|
||||
$header = ['title' => $data['title'], 'visible' => $visible];
|
||||
$header = ['title' => $data['title']];
|
||||
|
||||
if (isset($data['visible'])) {
|
||||
if ($data['visible'] == '' || $data['visible']) {
|
||||
// if auto (ie '')
|
||||
$children = $page->parent()->children();
|
||||
foreach ($children as $child) {
|
||||
if ($child->order()) {
|
||||
// set page order
|
||||
$page->order(1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($data['type'] == 'modular') {
|
||||
$header['body_classes'] = 'modular';
|
||||
@@ -582,25 +595,6 @@ class Admin
|
||||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
* Guess the intended visibility status based on other sibling folders
|
||||
*
|
||||
* @param \Grav\Common\Page\Page $page
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function guessVisibility(Page $page)
|
||||
{
|
||||
$children = $page->parent()->children();
|
||||
foreach ($children as $child) {
|
||||
if ($child->order()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static helper method to return current route.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user