1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-22 13:41:52 +02:00

Page breadcrumbs added to Magic Shortcode {---BREADCRUMB---}

This commit is contained in:
Cameron 2019-06-15 10:12:00 -07:00
parent 2d82a15282
commit 2fd5238172
3 changed files with 35 additions and 20 deletions
e107_core/shortcodes/batch
e107_handlers
page.php

@ -593,31 +593,36 @@ class cpage_shortcodes extends e_shortcode
}
function breadcrumb()
{
$breadcrumb = array();
$row = $this->getChapter();
$brow = $this->getBook($row['chapter_parent']);
if(empty($brow['chapter_sef']))
{
return null;
}
$row['book_sef'] = vartrue($brow['chapter_sef'],"no-sef-found"); //$this->getBook();
$breadcrumb[] = array('text'=> $brow['chapter_name'], 'url'=> e107::getUrl()->create('page/book/index', $brow,'allow=chapter_id,chapter_sef,book_sef,page_sef'));
$breadcrumb[] = array('text'=> $row['chapter_name'], 'url'=> e107::getUrl()->create('page/chapter/index', $row,'allow=chapter_id,chapter_sef,book_sef'));
e107::breadcrumb($breadcrumb);
}
function sc_chapter_breadcrumb()
{
$tp = e107::getParser();
$breadcrumb = array();
$row = $this->getChapter();
$brow = $this->getBook($row['chapter_parent']);
if(empty($brow['chapter_sef']))
{
return null;
}
$row['book_sef'] = vartrue($brow['chapter_sef'],"no-sef-found"); //$this->getBook();
$breadcrumb[] = array('text'=> $brow['chapter_name'], 'url'=> e107::getUrl()->create('page/book/index', $brow,'allow=chapter_id,chapter_sef,book_sef,page_sef'));
$breadcrumb[] = array('text'=> $row['chapter_name'], 'url'=> e107::getUrl()->create('page/chapter/index', $row,'allow=chapter_id,chapter_sef,book_sef'));
// $breadcrumb[] = array('text'=> $this->var['page_title'], 'url'=> null);
// $this->breadcrumb();
$breadcrumb = e107::breadcrumb();
return e107::getForm()->breadcrumb($breadcrumb);

@ -1671,6 +1671,12 @@ class e_shortcode
public function init() {}
/**
* Breadcrumb calculations should occur in here.
*/
public function breadcrumb() {}
/**
* Sets wrapper id (to be retrieved from the registry while parsing)
* Example e107::getScBatch('contact')->wrapper('contact/form');

@ -509,6 +509,7 @@ class pageClass
// $this->page = $page;
$this->batch->setVars($page);
$this->batch->breadcrumb();
// $this->batch->setVars(new e_vars($data))->setScVar('page', $this->page);
@ -591,7 +592,7 @@ class pageClass
$this->batch = e107::getScBatch('page',null,'cpage')->setVars($this->page)->wrapper('page/'.$this->templateID);
$this->batch->breadcrumb();
define("e_PAGETITLE", $this->page['page_title']);
@ -636,6 +637,7 @@ class pageClass
$this->batch = e107::getScBatch('page',null,'cpage');
$this->batch->wrapper('page/'.$this->templateID );
$this->batch->editable($editable);
$this->batch->breadcrumb();
$this->pageText = $this->page['page_text'];
@ -688,6 +690,7 @@ class pageClass
e107::getEvent()->trigger('user_page_item_viewed',$this->page);
$this->batch->setVars($this->page);
$this->batch->breadcrumb();
define('e_PAGETITLE', eHelper::formatMetaTitle($this->page['page_title']));
@ -747,6 +750,7 @@ class pageClass
/** @var cpage_shortcodes $sc */
$sc = e107::getScBatch('page',null,'cpage');
$sc->setVars($vars);
$sc->breadcrumb();
$comments = $sc->cpagecomments();
}
define('e_PAGETITLE', eHelper::formatMetaTitle($this->cacheData['TITLE']));