Skip to content

Commit

Permalink
Merge pull request #4186 from Laravel-Backpack/when-showing-fields-us…
Browse files Browse the repository at this point in the history
…e-get-first-field-view-method

In show_fields, use `getFirstFieldView()` method
  • Loading branch information
tabacitu authored Feb 12, 2022
2 parents a1376a1 + d856673 commit 2be4ff8
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/resources/views/crud/inc/show_fields.blade.php
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2be4ff8

Please sign in to comment.