Skip to content

Commit

Permalink
Fix Language Change Behavior on Single Post Page
Browse files Browse the repository at this point in the history
  • Loading branch information
Arno2005 committed Dec 27, 2024
1 parent dcdeac3 commit 535db17
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,17 @@ public function posts(Request $request, Response $response, PostTransformer $tra
/**
* Action - get single post
* @param Request $request
* @param Response $response
* @param ViewFactory $view
* @param PostTransformer $transformer
* @param string|null $lang
* @param string $postId
*/
public function post(Response $response, ViewFactory $view, PostTransformer $transformer, ?string $lang, string $postId)
public function post(Request $request, Response $response, ViewFactory $view, PostTransformer $transformer, ?string $lang, string $postId)
{
$ref = $request->get(\'ref\', \'posts\');
$post = $this->postService->getPost($postId);
if (!$post->asArray()) {
Expand All @@ -112,7 +115,8 @@ public function post(Response $response, ViewFactory $view, PostTransformer $tra
$view->setParams([
\'title\' => $post->title . \' | \' . config()->get(\'app_name\'),
\'langs\' => config()->get(\'langs\'),
\'post\' => current(transform([$post], $transformer))
\'post\' => current(transform([$post], $transformer)),
\'referer\' => $ref,
]);
$response->html($view->render(\'post/single\'));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return "
<a class=\"back-btn\" title=\"Back\" href=\"<?php echo get_referrer() ?: base_url(true) . '/' . current_lang() . '/posts'; ?>\">
<i class=\"material-icons\">arrow_back</i>
return '
<a class=\'back-btn\' title=\'Back\' href="<?php echo base_url(true) . \'/\' . current_lang() . \'/\' . $referer; ?>">
<i class=\'material-icons\'>arrow_back</i>
</a>
";
';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<img src="<?php echo base_url() ?>/assets/images/no-image.png" class="circle img-my-post">
<?php endif; ?>
<span class="title post-title" title="<?php echo $post[\'title\'] ?>">
<a class="teal-text post-title" href="<?php echo base_url(true) . \'/\' . current_lang() . \'/post/\' . $post[\'id\'] ?>">
<a class="teal-text post-title" href="<?php echo base_url(true) . \'/\' . current_lang() . \'/post/\' . $post[\'id\'] ?>?ref=my-posts">
<?php echo $post[\'title\'] ?>
</a>
</span>
Expand Down

0 comments on commit 535db17

Please sign in to comment.