Commit 61875d97 authored by Christian Giupponi's avatar Christian Giupponi

Possibile fix for alternate variable not set in page

parent b601dd31
...@@ -13,10 +13,25 @@ abstract class BasePublicController extends Controller ...@@ -13,10 +13,25 @@ abstract class BasePublicController extends Controller
*/ */
protected $auth; protected $auth;
public $locale; public $locale;
public $alternateUrls = [];
public function __construct() public function __construct()
{ {
$this->locale = App::getLocale(); $this->locale = App::getLocale();
$this->auth = app(Authentication::class); $this->auth = app(Authentication::class);
view()->share('alternate', $this->alternateUrls);
} }
/**
* Add alternate URLs to main array and inject it to the page
*
* @param array $alternateUrls
* @return void
*/
protected function addAlternateUrls(array $alternateUrls)
{
$this->alternateUrls = array_merge($this->alternateUrls, $alternateUrls);
view()->share('alternate', $this->alternateUrls);
}
}
} }
...@@ -46,9 +46,9 @@ class PublicController extends BasePublicController ...@@ -46,9 +46,9 @@ class PublicController extends BasePublicController
$template = $this->getTemplateForPage($page); $template = $this->getTemplateForPage($page);
$alternate = $this->getAlternateMetaData($page); $this->addAlternateUrls($this->getAlternateMetaData($page));
return view($template, compact('page', 'alternate')); return view($template, compact('page'));
} }
/** /**
...@@ -62,9 +62,9 @@ class PublicController extends BasePublicController ...@@ -62,9 +62,9 @@ class PublicController extends BasePublicController
$template = $this->getTemplateForPage($page); $template = $this->getTemplateForPage($page);
$alternate = $this->getAlternateMetaData($page); $this->addAlternateUrls($this->getAlternateMetaData($page));
return view($template, compact('page', 'alternate')); return view($template, compact('page'));
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment