Skip to content
Snippets Groups Projects
Commit 0b51db24 authored by Christel Loftus's avatar Christel Loftus
Browse files

tracking page link working

parent 61a9c3d1
Branches
Tags
2 merge requests!201.0.41,!15Tracking page
This commit is part of merge request !15. Comments created here will be created in the context of that merge request.
<?php <?php
namespace BobGroup\BobGo\Block; namespace BobGroup\BobGo\Block;
class YourBlock extends \Magento\Framework\View\Element\Template class TrackingBlock extends \Magento\Framework\View\Element\Template
{ {
public function __construct( public function __construct(
\Magento\Backend\Block\Template\Context $context, \Magento\Backend\Block\Template\Context $context,
......
<?php <?php
namespace BobGroup\BobGo\Controller\YourFirstLink; namespace BobGroup\BobGo\Controller\Tracking;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
......
<?php
namespace BobGroup\BobGo\Controller\YourSecondLink;
use Psr\Log\LoggerInterface;
class Index extends \Magento\Framework\App\Action\Action
{
/**
* @var \Magento\Framework\View\Result\PageFactory
*/
protected $resultPageFactory;
protected $logger;
/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Framework\View\Result\PageFactory resultPageFactory
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
LoggerInterface $logger,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
)
{
$this->resultPageFactory = $resultPageFactory;
$this->logger = $logger;
parent::__construct($context);
}
/**
* Default customer account page
*
* @return void
*/
public function execute()
{
$this->logger->info('Page2 Controller is executed.');
return $this->resultPageFactory->create();
}
}
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
<update handle="customer_account"/> <update handle="customer_account"/>
<head> <head>
<title> <title>
Your First Link Tracking
</title> </title>
</head> </head>
<body> <body>
<referenceContainer name="content"> <referenceContainer name="content">
<block class="BobGroup\BobGo\Block\YourBlock" name="bobgo.firstlink.index" template="BobGroup_BobGo::yourfirstlink/index.phtml" cacheable="false" /> <block class="BobGroup\BobGo\Block\TrackingBlock" name="bobgo.tracking.index" template="BobGroup_BobGo::tracking/index.phtml" cacheable="false" />
</referenceContainer> </referenceContainer>
</body> </body>
</page> </page>
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<head>
<title>
Your Second Link
</title>
</head>
<body>
<referenceContainer name="content">
<block class="Magento\Framework\View\Element\Template" name="bobgo.secondlink.index" template="BobGroup_BobGo::yoursecondlink/index.phtml" cacheable="false" />
</referenceContainer>
</body>
</page>
...@@ -3,16 +3,10 @@ ...@@ -3,16 +3,10 @@
<body> <body>
<referenceBlock name="customer_account_navigation"> <referenceBlock name="customer_account_navigation">
<!-- Add menu to the end of the sidebar --> <!-- Add menu to the end of the sidebar -->
<block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-your-first-link"> <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-tracking">
<arguments> <arguments>
<argument name="path" xsi:type="string">bobgo/yourfirstlink/index</argument> <argument name="path" xsi:type="string">bobgo/tracking/index</argument>
<argument name="label" xsi:type="string">Your First Link</argument> <argument name="label" xsi:type="string">Tracking</argument>
</arguments>
</block>
<block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-your-second-link">
<arguments>
<argument name="path" xsi:type="string">bobgo/yoursecondlink/index</argument>
<argument name="label" xsi:type="string">Your Second Link</argument>
</arguments> </arguments>
</block> </block>
</referenceBlock> </referenceBlock>
......
echo 'My Second Link Page';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment