mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-10-30 01:36:27 +01:00
Oops, bug fix
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="form-column block pure-u-1-{{ cols }}">
|
||||
{% for child in field.fields %}
|
||||
{% if child.type and not child.validate.ignore %}
|
||||
{% set value = child.name ? (form.value(field.name) ?? data.value(field.name)) : data.toArray %}
|
||||
{% set value = child.name ? (form.value(child.name) ?? data.value(child.name)) : data.toArray %}
|
||||
{% include ["forms/fields/#{child.type}/#{child.type}.html.twig", 'forms/fields/text/text.html.twig'] with {field: child} %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user