mirror of
https://github.com/flarum/core.git
synced 2025-08-05 07:57:46 +02:00
Add a "return home" link to 404 errors
This commit is contained in:
12
views/error/404.blade.php
Normal file
12
views/error/404.blade.php
Normal file
@@ -0,0 +1,12 @@
|
||||
@extends('flarum.forum::layouts.basic')
|
||||
|
||||
@section('content')
|
||||
<p>
|
||||
{{ $translator->trans('core.views.error.404_message') }}
|
||||
</p>
|
||||
<p>
|
||||
<a href="{{ $app->url() }}">
|
||||
{{ $translator->trans('core.views.error.404_return_link', ['{forum}' => $settings->get('forum_title')]) }}
|
||||
</a>
|
||||
</p>
|
||||
@endsection
|
22
views/error/default.blade.php
Normal file
22
views/error/default.blade.php
Normal file
@@ -0,0 +1,22 @@
|
||||
@extends('flarum.forum::layouts.basic')
|
||||
|
||||
@section('content')
|
||||
<p>
|
||||
{{-- TODO: Change below to @php when Laravel is upgraded --}}
|
||||
<?php
|
||||
$getTranslationIfExists = function ($code) use ($translator, $settings) {
|
||||
$key = 'core.views.error.'.$code.'_message';
|
||||
$translation = $translator->trans($key, ['{forum}' => $settings->get('forum_title')]);
|
||||
|
||||
return $translation === $key ? false : $translation;
|
||||
};
|
||||
|
||||
if (! $translation = $getTranslationIfExists($error->getCode())) {
|
||||
if (! $translation = $getTranslationIfExists(500)) {
|
||||
$translation = 'An error occurred while trying to load this page.';
|
||||
}
|
||||
}
|
||||
?>
|
||||
{{ $translation }}
|
||||
</p>
|
||||
@endsection
|
Reference in New Issue
Block a user