FEATURE: make title in contents overview translatable and modifiable by module

This commit is contained in:
Michal Kváček
2016-09-05 00:00:52 +02:00
parent 8c4b1ad69b
commit 5ef2630810
4 changed files with 17 additions and 6 deletions
@@ -32,11 +32,16 @@ class ContentOverview extends Controller
{
$moduleFilterHandler = false;
$perPage = Input::get('perPage') ? Input::get('perPage') : 20;
$pageHeading = 'admin/contents.overview';
// does user want to filter results using module?
if (is_numeric($moduleId)) {
$module = Module::findOrFail($moduleId);
$moduleFilterHandler = $module->handler;
if (is_callable([$module->handler, 'getOverviewTitle'])) {
$pageHeading = call_user_func([$module->handler, 'getOverviewTitle']);
}
}
// get pages for overview
@@ -49,6 +54,7 @@ class ContentOverview extends Controller
return view('admin.content.overview', [
'pages' => $pages,
'homepage' => $homepage,
'pageHeading' => $pageHeading,
'statuses' => ContentStatuses::getWithTranslations(),
'module' => isset($module) ? $module : null
]);
@@ -79,6 +79,10 @@ class Article extends Handler
return $changedColumns;
}
public static function getOverviewTitle() {
return trans('article::module.allArticles');
}
/**
*
* @param User $user
@@ -3,5 +3,6 @@ return [
'name' => 'Article',
'description' => 'Base submodule for blog',
'comments' => 'Comments',
'commentsOverview' => 'All comments'
'commentsOverview' => 'All comments',
'allArticles' => 'All articles'
];
@@ -1,6 +1,6 @@
@extends('admin.layoutWithNavigation')
@section('pageHeading', @trans('admin/contents.overview'))
@section('pageHeading', @trans(isset($pageHeading) ? $pageHeading : 'admin/contents.overview'))
@section('headerButtons')
@if($module)