diff --git a/src/MenuCRUDServiceProvider.php b/src/MenuCRUDServiceProvider.php index ca9c58d..066801a 100644 --- a/src/MenuCRUDServiceProvider.php +++ b/src/MenuCRUDServiceProvider.php @@ -28,8 +28,12 @@ class MenuCRUDServiceProvider extends ServiceProvider */ public function boot() { + // publish views + $this->publishes([__DIR__.'/resources/views' => base_path('resources/views/vendor/backpack/crud')], 'views'); // publish migrations $this->publishes([__DIR__.'/database/migrations' => database_path('migrations')], 'migrations'); + + $this->loadViewsFrom(realpath(__DIR__.'/resources/views'), 'menucrud'); } /** diff --git a/src/app/Http/Controllers/Admin/MenuItemCrudController.php b/src/app/Http/Controllers/Admin/MenuItemCrudController.php index b05ac98..78e41ed 100644 --- a/src/app/Http/Controllers/Admin/MenuItemCrudController.php +++ b/src/app/Http/Controllers/Admin/MenuItemCrudController.php @@ -53,6 +53,7 @@ public function setup() 'label' => 'Type', 'type' => 'page_or_link', 'page_model' => '\Backpack\PageManager\app\Models\Page', + 'view_namespace' => file_exists(resource_path('views/vendor/backpack/crud/fields/page_or_link.blade.php')) ? null : 'menucrud::fields', ]); }); } diff --git a/src/resources/views/fields/page_or_link.blade.php b/src/resources/views/fields/page_or_link.blade.php new file mode 100644 index 0000000..236100b --- /dev/null +++ b/src/resources/views/fields/page_or_link.blade.php @@ -0,0 +1,161 @@ +{{-- PAGE OR LINK field --}} +{{-- Used in Backpack\MenuCRUD --}} + + + +@include('crud::fields.inc.wrapper_start') + + @include('crud::fields.inc.translatable_icon') + +
+ {{-- hidden placeholders for content --}} + + + +
+ {{-- type select --}} + +
+
+ {{-- page slug input --}} + + + {{-- internal link input --}} + + + {{-- external link input --}} + +
+
+ + {{-- HINT --}} + @if (isset($field['hint'])) +

{!! $field['hint'] !!}

+ @endif + +@include('crud::fields.inc.wrapper_end') + + +{{-- ########################################## --}} +{{-- Extra CSS and JS for this particular field --}} +{{-- If a field type is shown multiple times on a form, the CSS and JS will only be loaded once --}} +@if ($crud->fieldTypeNotLoaded($field)) + @php + $crud->markFieldTypeAsLoaded($field); + @endphp + + {{-- FIELD JS - will be loaded in the after_scripts section --}} + @push('crud_fields_scripts') + + @endpush + +@endif +{{-- End of Extra CSS and JS --}} +{{-- ########################################## --}} \ No newline at end of file