diff --git a/Block/System/Config/Form/Field/Version.php b/Block/System/Config/Form/Field/Version.php deleted file mode 100644 index 2ebcbba8b10029a319b41a897bdca308050f8a9e..0000000000000000000000000000000000000000 --- a/Block/System/Config/Form/Field/Version.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -namespace BobGroup\BobGo\Block\System\Config\Form\Field; - -use Magento\Framework\Data\Form\Element\AbstractElement; -use BobGroup\BobGo\Helper\Data; - -/** - * Displays Version number in System Configuration - * - * This block is responsible for displaying the version number of the BobGo extension - * in the system configuration settings. - * - * @website https://www.bobgo.co.za - */ -class Version extends \Magento\Config\Block\System\Config\Form\Field -{ - /** - * @var string - */ - public const EXTENSION_URL = 'https://www.bobgo.co.za'; - - /** - * @var Data - */ - protected Data $_helper; - - /** - * Constructor - * - * @param \Magento\Backend\Block\Template\Context $context - * @param Data $helper - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - Data $helper - ) { - $this->_helper = $helper; - parent::__construct($context); - } - - /** - * Get HTML for the element - * - * @param AbstractElement $element - * @return string - */ - protected function _getElementHtml(AbstractElement $element): string - { - $extensionVersion = $this->_helper->getExtensionVersion(); - $extensionTitle = 'BobGo'; - $versionLabel = sprintf( - '<a href="%s" title="%s" target="_blank">%s</a>', - self::EXTENSION_URL, - $extensionTitle, - $extensionVersion - ); - - // Set the value using setData - $element->setData('value', $versionLabel); - - // Ensure the return value is a string or provide a fallback - $value = $element->getData('value'); - return is_string($value) ? $value : ''; - } -} diff --git a/Block/TrackOrder.php b/Block/YourBlock.php similarity index 82% rename from Block/TrackOrder.php rename to Block/YourBlock.php index 49983f644ba7cc4a1558d043f5c19bef73679237..c3e7e012184ceacd55180b8ddda7dc0563f526ff 100644 --- a/Block/TrackOrder.php +++ b/Block/YourBlock.php @@ -1,6 +1,6 @@ <?php namespace BobGroup\BobGo\Block; -class TrackOrder extends \Magento\Framework\View\Element\Template +class YourBlock extends \Magento\Framework\View\Element\Template { public function __construct( \Magento\Backend\Block\Template\Context $context, diff --git a/Controller/Test/Index.php b/Controller/Test/Index.php deleted file mode 100644 index 115b9503ba488a5f7053af50f602b214beefdf50..0000000000000000000000000000000000000000 --- a/Controller/Test/Index.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -namespace BobGroup\BobGo\Controller\Test; - -use Magento\Framework\App\Action\Action; -use Magento\Framework\App\Action\Context; - -class Index extends Action -{ - public function __construct(Context $context) - { - parent::__construct($context); - } - - public function execute() - { - echo "Test controller works!"; - exit; - } -} diff --git a/Controller/TrackOrder/Index.php b/Controller/YourFirstLink/Index.php similarity index 76% rename from Controller/TrackOrder/Index.php rename to Controller/YourFirstLink/Index.php index 0810484f2392c9f65c04d672f349d4b1ba11fba9..51781bc194ae1df7d2ad53c4684094b1dd9ba585 100644 --- a/Controller/TrackOrder/Index.php +++ b/Controller/YourFirstLink/Index.php @@ -1,6 +1,7 @@ <?php +namespace BobGroup\BobGo\Controller\YourFirstLink; -namespace BobGroup\BobGo\Controller\TrackOrder; +use Psr\Log\LoggerInterface; class Index extends \Magento\Framework\App\Action\Action { @@ -9,16 +10,20 @@ class Index extends \Magento\Framework\App\Action\Action */ 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); } /** @@ -28,6 +33,7 @@ class Index extends \Magento\Framework\App\Action\Action */ public function execute() { + $this->logger->info('Page Controller is executed.'); return $this->resultPageFactory->create(); } } diff --git a/Controller/YourSecondLink/Index.php b/Controller/YourSecondLink/Index.php new file mode 100644 index 0000000000000000000000000000000000000000..be383122aa5adc80709f0168e2adc883b93fb435 --- /dev/null +++ b/Controller/YourSecondLink/Index.php @@ -0,0 +1,38 @@ +<?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(); + } +} diff --git a/etc/frontend/routes.xml b/etc/frontend/routes.xml index e0d84f8adab2918c5e419b226b4b9fa6cb9f5a51..d6d10467741f62ea0f0f24d7fba12bc9e921e814 100644 --- a/etc/frontend/routes.xml +++ b/etc/frontend/routes.xml @@ -1,6 +1,8 @@ +<?xml version="1.0"?> + <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="standard"> - <route id="trackorder" frontName="trackorder"> + <route id="bobgo" frontName="bobgo"> <module name="BobGroup_BobGo" /> </route> </router> diff --git a/view/frontend/layout/bobgo_trackorder_index.xml b/view/frontend/layout/bobgo_trackorder_index.xml deleted file mode 100644 index 91e4a809fe41c1145db54758e8fd2acbe167f036..0000000000000000000000000000000000000000 --- a/view/frontend/layout/bobgo_trackorder_index.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?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 First Link - </title> -</head> -<body> - <referenceContainer name="content"> - <block class="BobGroup\BobGo\Block\TrackOrder" name="bobgo.trackorder.index" template="BobGroup_BobGo::trackorder/index.phtml" cacheable="false" /> - </referenceContainer> -</body> -</page> diff --git a/view/frontend/layout/bobgo_yourfirstlink_index.xml b/view/frontend/layout/bobgo_yourfirstlink_index.xml new file mode 100644 index 0000000000000000000000000000000000000000..f5178aec8e07c04b5e670d74cb974d438c414853 --- /dev/null +++ b/view/frontend/layout/bobgo_yourfirstlink_index.xml @@ -0,0 +1,14 @@ +<?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 First Link + </title> + </head> + <body> + <referenceContainer name="content"> + <block class="BobGroup\BobGo\Block\YourBlock" name="bobgo.firstlink.index" template="BobGroup_BobGo::yourfirstlink/index.phtml" cacheable="false" /> + </referenceContainer> + </body> +</page> diff --git a/view/frontend/layout/bobgo_yoursecondlink_index.xml b/view/frontend/layout/bobgo_yoursecondlink_index.xml new file mode 100644 index 0000000000000000000000000000000000000000..d4563811b05e04d60cd5c65164585c4fd0876c43 --- /dev/null +++ b/view/frontend/layout/bobgo_yoursecondlink_index.xml @@ -0,0 +1,14 @@ +<?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> diff --git a/view/frontend/layout/customer_account.xml b/view/frontend/layout/customer_account.xml index 50bb287be14f26a6e791aaeb42c2ca438bc7aa28..cdc2464aeb58a5f031d5dde024f8eedde3ed71df 100644 --- a/view/frontend/layout/customer_account.xml +++ b/view/frontend/layout/customer_account.xml @@ -1,20 +1,20 @@ <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> - <body> - <referenceBlock name="customer_account_navigation"> - <!-- Add menu to the end of the sidebar --> - <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-your-first-link"> - <arguments> - <argument name="path" xsi:type="string">BobGo/TrackOrder/index</argument> - <argument name="label" xsi:type="string">Your First Link</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/TrackOrder/index</argument> - <argument name="label" xsi:type="string">Your Second Link</argument> - </arguments> - </block> - </referenceBlock> - </body> +<body> + <referenceBlock name="customer_account_navigation"> + <!-- Add menu to the end of the sidebar --> + <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-your-first-link"> + <arguments> + <argument name="path" xsi:type="string">bobgo/yourfirstlink/index</argument> + <argument name="label" xsi:type="string">Your First Link</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> + </block> + </referenceBlock> +</body> </page> diff --git a/view/frontend/templates/secondlink/index.phtml b/view/frontend/templates/secondlink/index.phtml new file mode 100644 index 0000000000000000000000000000000000000000..c19dc873d343fd3351f39bd8f7099f406312b52b --- /dev/null +++ b/view/frontend/templates/secondlink/index.phtml @@ -0,0 +1 @@ +echo 'My Second Link Page'; diff --git a/view/frontend/templates/TrackOrder/index.phtml b/view/frontend/templates/yourfirstlink/index.phtml similarity index 100% rename from view/frontend/templates/TrackOrder/index.phtml rename to view/frontend/templates/yourfirstlink/index.phtml