mirror of
				https://github.com/getgrav/grav-plugin-admin.git
				synced 2025-10-31 10:25:50 +01:00 
			
		
		
		
	Oops, bug fix
This commit is contained in:
		| @@ -1661,17 +1661,23 @@ class AdminController extends AdminBaseController | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         $route  = $data['route'] !== '/' ? $data['route'] : ''; |         $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 |         // Handle @slugify-{field} value, automatically slugifies the specified field | ||||||
|         if (0 === strpos($folder, '@slugify-')) { |         if (null !== $folder && 0 === strpos($folder, '@slugify-')) { | ||||||
|             $folder = \Grav\Plugin\Admin\Utils::slug($data[substr($folder, 9)]); |             $folder = \Grav\Plugin\Admin\Utils::slug($data[substr($folder, 9)] ?? ''); | ||||||
|  |         } | ||||||
|  |         if (!$folder) { | ||||||
|  |             $folder = \Grav\Plugin\Admin\Utils::slug($title) ?: ''; | ||||||
|         } |         } | ||||||
|         $folder = ltrim($folder, '_'); |         $folder = ltrim($folder, '_'); | ||||||
|         if (!empty($data['modular'])) { |         if (!empty($data['modular'])) { | ||||||
|             $folder = '_' . $folder; |             $folder = '_' . $folder; | ||||||
|         } |         } | ||||||
|         $path = $route . '/' . $folder; |         $data['folder'] = $folder; | ||||||
|  |  | ||||||
|  |         $path = $route . '/' . $folder; | ||||||
|         $this->admin->session()->{$path} = $data; |         $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 |         // 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 }}"> |     <div class="form-column block pure-u-1-{{ cols }}"> | ||||||
|     {% for child in field.fields %} |     {% for child in field.fields %} | ||||||
|         {% if child.type and not child.validate.ignore %} |         {% 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} %} |             {% include ["forms/fields/#{child.type}/#{child.type}.html.twig", 'forms/fields/text/text.html.twig'] with {field: child} %} | ||||||
|         {% endif %} |         {% endif %} | ||||||
|     {% endfor %} |     {% endfor %} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user