File tree Expand file tree Collapse file tree 3 files changed +23
-12
lines changed Expand file tree Collapse file tree 3 files changed +23
-12
lines changed Original file line number Diff line number Diff line change 1212namespace App \Base \Traits ;
1313
1414use \App \Base \Abstracts \ContainerAwareObject ;
15+ use \App \Site \Controllers \Frontend \Page ;
16+ use \App \Site \Models \Page as PageModel ;
1517
1618/**
1719 * Pages Trait
@@ -86,4 +88,23 @@ protected function getTokenData()
8688
8789 return false ;
8890 }
91+
92+ public function isHomePage ()
93+ {
94+ if ($ this instanceof Page) {
95+ if ($ this ->getObject () instanceof PageModel && $ this ->getObject ()->isLoaded ()) {
96+ $ homepage_id = $ this ->getSiteData ()->getHomePageId ($ this ->getSiteData ()->getCurrentWebsite (), $ this ->getObject ()->getLocale ());
97+
98+ if ($ this ->getObject ()->getId () == $ homepage_id ) {
99+ return true ;
100+ }
101+ }
102+ }
103+
104+ if (is_array ($ this ->route_info ->getHandler ()) && $ this ->route_info ->getHandler ()[1 ] == 'showFrontPage ' ) {
105+ return true ;
106+ }
107+
108+ return false ;
109+ }
89110}
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public function renderHTML(BasePage $current_page = null)
5050 $ current_page ->getCurrentLocale ()
5151 );
5252
53- if (( $ current_page instanceof Page) && ( $ current_page -> getPageId () != $ homepageid )) {
53+ if (! $ current_page-> isHomePage ( )) {
5454 $ breadcrumbs_links [] = '<a href=" ' .$ home_url .'"> ' .$ this ->getUtils ()->translate ('Home ' , $ locale ).'</a> ' ;
5555 }
5656
Original file line number Diff line number Diff line change @@ -40,17 +40,7 @@ public static function getRoutePath()
4040 */
4141 protected function getTemplateName ()
4242 {
43- if ($ this ->getObject () instanceof PageModel && $ this ->getObject ()->isLoaded ()) {
44- if (!empty ($ this ->getObject ()->getTemplateName ())) {
45- return $ this ->getObject ()->getTemplateName ();
46- }
47- $ homepage_id = $ this ->getSiteData ()->getHomePageId ($ this ->getSiteData ()->getCurrentWebsite (), $ this ->getObject ()->getLocale ());
48- if ($ this ->getObject ()->getId () == $ homepage_id ) {
49- return 'homepage ' ;
50- }
51- }
52-
53- if (is_array ($ this ->route_info ->getHandler ()) && $ this ->route_info ->getHandler ()[1 ] == 'showFrontPage ' ) {
43+ if ($ this ->isHomePage ()) {
5444 return 'homepage ' ;
5545 }
5646
You can’t perform that action at this time.
0 commit comments