Oops, bug fix

This commit is contained in:
Matias Griese
2020-03-03 15:01:17 +02:00
parent 3cc76877b2
commit 9e3f19818d
2 changed files with 11 additions and 5 deletions

View File

@@ -1661,17 +1661,23 @@ class AdminController extends AdminBaseController
}
$route = $data['route'] !== '/' ? $data['route'] : '';
$folder = $data['folder'];
$folder = $data['folder'] ?? null;
$title = $data['title'] ?? null;
// Handle @slugify-{field} value, automatically slugifies the specified field
if (0 === strpos($folder, '@slugify-')) {
$folder = \Grav\Plugin\Admin\Utils::slug($data[substr($folder, 9)]);
if (null !== $folder && 0 === strpos($folder, '@slugify-')) {
$folder = \Grav\Plugin\Admin\Utils::slug($data[substr($folder, 9)] ?? '');
}
if (!$folder) {
$folder = \Grav\Plugin\Admin\Utils::slug($title) ?: '';
}
$folder = ltrim($folder, '_');
if (!empty($data['modular'])) {
$folder = '_' . $folder;
}
$path = $route . '/' . $folder;
$data['folder'] = $folder;
$path = $route . '/' . $folder;
$this->admin->session()->{$path} = $data;
// Store the name and route of a page, to be used pre-filled defaults of the form in the future