Skip to content

Commit a92f351

Browse files
committed
feat: enhance web view retrieval with default fallback for non-existing views
1 parent 223c0eb commit a92f351

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Models/PostType.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,13 @@ public function getFeatureCollectionName(string|PostTypeFeatures $feature): ?str
199199
*/
200200
public function getWebView(string $action = 'index'): string
201201
{
202-
return 'web.post-type.' . $this->slug . '.' . $action;
202+
$view = 'web.post-type.' . $this->slug . '.' . $action;
203+
204+
if (view()->exists($view)) {
205+
return $view;
206+
}
207+
208+
return 'web.post-type.default.' . $action;
203209
}
204210

205211
/**

0 commit comments

Comments
 (0)