Skip to content

Commit 5f48d55

Browse files
authored
Merge pull request #3 from librarianphp/update-librarian-core
Updating librarian core, now injecting contentType in views
2 parents cf2cf6a + 373358d commit 5f48d55

File tree

7 files changed

+116
-132
lines changed

7 files changed

+116
-132
lines changed

Command/Web/ContentController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace librarianphp\Web;
44

5+
use Librarian\ContentType;
56
use Librarian\Provider\TwigServiceProvider;
67
use Librarian\Response;
78
use Librarian\Provider\ContentServiceProvider;
@@ -14,7 +15,7 @@
1415
*/
1516
class ContentController extends WebController
1617
{
17-
public function handle(): int
18+
public function handle(): void
1819
{
1920
/** @var TwigServiceProvider $twig */
2021
$twig = $this->getApp()->twig;
@@ -37,17 +38,17 @@ public function handle(): int
3738
}
3839

3940
$start = ($page * $limit) - $limit;
40-
41-
$content_list = $content_provider->fetchFrom($request->getRoute(), $start, $limit);
41+
$contentType = $content_provider->getContentType($request->getRoute());
42+
$content_list = $content_provider->fetchFrom($contentType, $start, $limit);
4243
$response = new Response($twig->render('content/listing.html.twig', [
4344
'content_list' => $content_list,
4445
'total_pages' => $content_provider->fetchTotalPages($limit),
4546
'current_page' => $page,
46-
'base_url' => $request->getRoute()
47+
'base_url' => $request->getRoute(),
48+
'content_type' => $contentType
4749
]));
4850

4951
$response->output();
50-
return 0;
5152
}
5253
} catch (\Exception $e) {
5354
Response::redirect('/notfound');
@@ -60,6 +61,5 @@ public function handle(): int
6061

6162
$response = new Response($output);
6263
$response->output();
63-
return 0;
6464
}
6565
}

Command/Web/ErrorController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class ErrorController extends WebController
1010
{
11-
public function handle()
11+
public function handle(): void
1212
{
1313
/** @var Environment $twig */
1414
$twig = $this->getApp()->twig;

Command/Web/FeedController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class FeedController extends WebController
1313
{
14-
public function handle()
14+
public function handle(): void
1515
{
1616
$feed = new Feed();
1717
$channel = new Channel();

Command/Web/IndexController.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class IndexController extends WebController
1212
{
13-
public function handle()
13+
public function handle(): void
1414
{
1515
/** @var TwigServiceProvider $twig */
1616
$twig = $this->getApp()->twig;
@@ -27,7 +27,6 @@ public function handle()
2727
]));
2828

2929
$response->output();
30-
return 0;
3130
}
3231
}
3332

@@ -52,6 +51,5 @@ public function handle()
5251
$response = new Response($output);
5352

5453
$response->output();
55-
return 0;
5654
}
5755
}

Command/Web/NotFoundController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class NotFoundController extends WebController
1010
{
11-
public function handle()
11+
public function handle(): void
1212
{
1313
/** @var Environment $twig */
1414
$twig = $this->getApp()->twig;

Command/Web/TagController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class TagController extends WebController
1212
/**
1313
* @throws \Exception
1414
*/
15-
public function handle()
15+
public function handle(): void
1616
{
1717
/** @var TwigServiceProvider $twig */
1818
$twig = $this->getApp()->twig;

0 commit comments

Comments
 (0)