From d8566730b01283670b55ceaf109c65d9d27e8cea Mon Sep 17 00:00:00 2001 From: Cristian Tabacitu Date: Sat, 12 Feb 2022 14:47:26 +0200 Subject: [PATCH] in show_fields, use getFirstFieldView method instead of manually doing the same thing in the blade file --- src/resources/views/crud/inc/show_fields.blade.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/resources/views/crud/inc/show_fields.blade.php b/src/resources/views/crud/inc/show_fields.blade.php index b91c4f2561..74a05da7b9 100644 --- a/src/resources/views/crud/inc/show_fields.blade.php +++ b/src/resources/views/crud/inc/show_fields.blade.php @@ -1,17 +1,5 @@ {{-- Show the inputs --}} @foreach ($fields as $field) - @php - // if the namespace is given, use that, no questions asked, otherwise - // load it from the first view_namespace that holds that field - if (isset($field['view_namespace'])) { - $fieldPaths = [$field['view_namespace'].'.'.$field['type']]; - } else { - $fieldPaths = array_map(function($item) use ($field) { - return $item.'.'.$field['type']; - }, config('backpack.crud.view_namespaces.fields')); - } - @endphp - - @includeFirst($fieldPaths, ['field' => $field]) + @include($crud->getFirstFieldView($field['type'], $field['view_namespace'] ?? false), $field) @endforeach