File tree Expand file tree Collapse file tree 5 files changed +107
-2
lines changed
Expand file tree Collapse file tree 5 files changed +107
-2
lines changed Original file line number Diff line number Diff line change 66 "magento/magento-composer-installer" : " *"
77 },
88 "type" : " magento2-module" ,
9- "version" : " 0.1.5 " ,
9+ "version" : " 0.2.0 " ,
1010 "autoload" : {
1111 "files" : [
1212 " src/registration.php"
Original file line number Diff line number Diff line change @@ -31,6 +31,41 @@ public function __construct(
3131 $ this ->postApi = $ postApi ;
3232 }
3333
34+ /**
35+ * override to add in breadcrumbs
36+ * @return mixed
37+ */
38+ protected function _prepareLayout ()
39+ {
40+ $ title = $ this ->getCategory ()->getTitle ()->getRendered ();
41+ if ($ breadcrumbsBlock = $ this ->getLayout ()->getBlock ('breadcrumbs ' )) {
42+ $ breadcrumbsBlock ->addCrumb (
43+ 'home ' ,
44+ [
45+ 'label ' => __ ('Home ' ),
46+ 'title ' => __ ('Home ' ),
47+ 'link ' => $ this ->_storeManager ->getStore ()->getBaseUrl ()
48+ ]
49+ );
50+ $ breadcrumbsBlock ->addCrumb (
51+ 'blog ' ,
52+ [
53+ 'label ' => __ ('Blog ' ),
54+ 'title ' => __ ('Blog ' ),
55+ 'link ' => $ this ->_urlBuilder ->getUrl ('blog ' )
56+ ]
57+ );
58+ $ breadcrumbsBlock ->addCrumb (
59+ 'post ' ,
60+ [
61+ 'label ' => __ ($ title ),
62+ 'title ' => __ ($ title )
63+ ]
64+ );
65+ }
66+ return parent ::_prepareLayout ();
67+ }
68+
3469 /** @return DataObject */
3570 public function getCategory ()
3671 {
Original file line number Diff line number Diff line change @@ -24,6 +24,41 @@ public function __construct(
2424 $ this ->registry = $ registry ;
2525 }
2626
27+ /**
28+ * override to add in breadcrumbs
29+ * @return mixed
30+ */
31+ protected function _prepareLayout ()
32+ {
33+ $ title = $ this ->getPage ()->getTitle ()->getRendered ();
34+ if ($ breadcrumbsBlock = $ this ->getLayout ()->getBlock ('breadcrumbs ' )) {
35+ $ breadcrumbsBlock ->addCrumb (
36+ 'home ' ,
37+ [
38+ 'label ' => __ ('Home ' ),
39+ 'title ' => __ ('Home ' ),
40+ 'link ' => $ this ->_storeManager ->getStore ()->getBaseUrl ()
41+ ]
42+ );
43+ $ breadcrumbsBlock ->addCrumb (
44+ 'blog ' ,
45+ [
46+ 'label ' => __ ('Blog ' ),
47+ 'title ' => __ ('Blog ' ),
48+ 'link ' => $ this ->_urlBuilder ->getUrl ('blog ' )
49+ ]
50+ );
51+ $ breadcrumbsBlock ->addCrumb (
52+ 'post ' ,
53+ [
54+ 'label ' => __ ($ title ),
55+ 'title ' => __ ($ title )
56+ ]
57+ );
58+ }
59+ return parent ::_prepareLayout ();
60+ }
61+
2762 /** @return DataObject */
2863 public function getPage ()
2964 {
Original file line number Diff line number Diff line change @@ -31,6 +31,41 @@ public function __construct(
3131 $ this ->mediaApi = $ mediaApi ;
3232 }
3333
34+ /**
35+ * override to add in breadcrumbs
36+ * @return mixed
37+ */
38+ protected function _prepareLayout ()
39+ {
40+ $ title = $ this ->getPost ()->getTitle ()->getRendered ();
41+ if ($ breadcrumbsBlock = $ this ->getLayout ()->getBlock ('breadcrumbs ' )) {
42+ $ breadcrumbsBlock ->addCrumb (
43+ 'home ' ,
44+ [
45+ 'label ' => __ ('Home ' ),
46+ 'title ' => __ ('Home ' ),
47+ 'link ' => $ this ->_storeManager ->getStore ()->getBaseUrl ()
48+ ]
49+ );
50+ $ breadcrumbsBlock ->addCrumb (
51+ 'blog ' ,
52+ [
53+ 'label ' => __ ('Blog ' ),
54+ 'title ' => __ ('Blog ' ),
55+ 'link ' => $ this ->_urlBuilder ->getUrl ('blog ' )
56+ ]
57+ );
58+ $ breadcrumbsBlock ->addCrumb (
59+ 'post ' ,
60+ [
61+ 'label ' => __ ($ title ),
62+ 'title ' => __ ($ title )
63+ ]
64+ );
65+ }
66+ return parent ::_prepareLayout ();
67+ }
68+
3469 /** @return DataObject */
3570 public function getPost ()
3671 {
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" ?>
22<config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:Module/etc/module.xsd" >
3- <module name =" Skywire_WordpressApi" setup_version =" 0.1.5 " >
3+ <module name =" Skywire_WordpressApi" setup_version =" 0.2.0 " >
44 </module >
55</config >
You can’t perform that action at this time.
0 commit comments