mirror of
				https://github.com/getgrav/grav-plugin-admin.git
				synced 2025-10-31 02:16:26 +01:00 
			
		
		
		
	More windows fixes for parent field
This commit is contained in:
		| @@ -2320,6 +2320,8 @@ class AdminController extends AdminBaseController | |||||||
|             $msg = 'PLUGIN_ADMIN.PAGE_ROUTE_FOUND'; |             $msg = 'PLUGIN_ADMIN.PAGE_ROUTE_FOUND'; | ||||||
|             foreach (new \DirectoryIterator($path) as $fileInfo) { |             foreach (new \DirectoryIterator($path) as $fileInfo) { | ||||||
|                 $fileName = $fileInfo->getFilename(); |                 $fileName = $fileInfo->getFilename(); | ||||||
|  |                 $filePath = str_replace('\\', '/', $fileInfo->getPathname()); | ||||||
|  |  | ||||||
|                 if (($fileInfo->isDot() && $fileName !== '.' && $initial) || (Utils::startsWith($fileName, '.') && strlen($fileName) > 1)) { |                 if (($fileInfo->isDot() && $fileName !== '.' && $initial) || (Utils::startsWith($fileName, '.') && strlen($fileName) > 1)) { | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
| @@ -2340,9 +2342,8 @@ class AdminController extends AdminBaseController | |||||||
|                         continue; |                         continue; | ||||||
|                     } |                     } | ||||||
|                 } else { |                 } else { | ||||||
|                     $file_path = str_replace('\\', '/', $fileInfo->getPathname()); |                     $file_page = $page_instances[$filePath] ?? null; | ||||||
|                     $file_page = $page_instances[$file_path] ?? null; |                     $file_path = Utils::replaceFirstOccurrence(GRAV_ROOT, '', $filePath); | ||||||
|                     $file_path = Utils::replaceFirstOccurrence(GRAV_ROOT, '', $file_path); |  | ||||||
|                     $type = $fileInfo->getType(); |                     $type = $fileInfo->getType(); | ||||||
|  |  | ||||||
|                     $payload = [ |                     $payload = [ | ||||||
| @@ -2357,6 +2358,11 @@ class AdminController extends AdminBaseController | |||||||
|                     ]; |                     ]; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  |                 // Fix for symlink | ||||||
|  |                 if ($payload['type'] === 'link' && $payload['extension'] === '') { | ||||||
|  |                     $payload['type'] = 'dir'; | ||||||
|  |                 } | ||||||
|  |  | ||||||
|                 // filter types |                 // filter types | ||||||
|                 if ($filters['type']) { |                 if ($filters['type']) { | ||||||
|                     if (!in_array($payload['type'], $filter_type)) { |                     if (!in_array($payload['type'], $filter_type)) { | ||||||
| @@ -2371,7 +2377,7 @@ class AdminController extends AdminBaseController | |||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 // Add children if any |                 // Add children if any | ||||||
|                 if ($fileInfo->getPathname() == $extra && is_array($children)) { |                 if ($filePath == $extra && is_array($children)) { | ||||||
|                     $payload['children'] = array_values($children); |                     $payload['children'] = array_values($children); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user