-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2653 from romainruaud/feature-elasticsuite-footer…
…-version Append Elasticsuite version to adminhtml footer.
- Loading branch information
Showing
4 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
src/module-elasticsuite-core/Block/Adminhtml/System/Version.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
/** | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteCore | ||
* @author Romain Ruaud <[email protected]> | ||
* @copyright 2020 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
|
||
namespace Smile\ElasticsuiteCore\Block\Adminhtml\System; | ||
|
||
/** | ||
* Version block to display in footer. | ||
* | ||
* @SuppressWarnings(PHPMD.CamelCasePropertyName) The property _template is inherited | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteCore | ||
* @author Romain Ruaud <[email protected]> | ||
*/ | ||
class Version extends \Magento\Backend\Block\Template | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $_template = 'Smile_ElasticsuiteCore::system/version.phtml'; | ||
|
||
/** | ||
* @var \Smile\ElasticsuiteCore\Model\ProductMetadata | ||
*/ | ||
protected $productMetadata; | ||
|
||
/** | ||
* @param \Magento\Backend\Block\Template\Context $context Block context | ||
* @param \Smile\ElasticsuiteCore\Model\ProductMetadata $productMetadata Product Metadata | ||
* @param array $data Block data | ||
*/ | ||
public function __construct( | ||
\Magento\Backend\Block\Template\Context $context, | ||
\Smile\ElasticsuiteCore\Model\ProductMetadata $productMetadata, | ||
array $data = [] | ||
) { | ||
$this->productMetadata = $productMetadata; | ||
parent::__construct($context, $data); | ||
} | ||
|
||
/** | ||
* Get Elasticsuite product version | ||
* | ||
* @return string | ||
*/ | ||
public function getElasticsuiteVersion() | ||
{ | ||
return $this->productMetadata->getVersion(); | ||
} | ||
|
||
/** | ||
* Get Elasticsuite product edition | ||
* | ||
* @return string | ||
*/ | ||
public function getElasticsuiteEdition() | ||
{ | ||
return $this->productMetadata->getEdition(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
* @SuppressWarnings(PHPMD.CamelCaseMethodName) | ||
*/ | ||
protected function _construct() | ||
{ | ||
$this->setShowProfiler(true); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected function getCacheLifetime() | ||
{ | ||
return 3600 * 24 * 10; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ | |
use Magento\Framework\App\Config; | ||
use Magento\Framework\App\Filesystem\DirectoryList; | ||
use Magento\Framework\App\ObjectManager; | ||
use Magento\Framework\App\ProductMetadataInterface; | ||
use Magento\Framework\Composer\ComposerFactory; | ||
use \Smile\ElasticsuiteCore\Model\ProductMetadata\ComposerInformation; | ||
use Magento\Framework\Composer\ComposerJsonFinder; | ||
|
@@ -29,7 +28,7 @@ | |
* @package Smile\ElasticsuiteCore | ||
* @author Romain Ruaud <[email protected]> | ||
*/ | ||
class ProductMetadata implements ProductMetadataInterface | ||
class ProductMetadata | ||
{ | ||
/** | ||
* Elasticsuite product edition | ||
|
28 changes: 28 additions & 0 deletions
28
src/module-elasticsuite-core/view/adminhtml/layout/default.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Adminhtml default layout | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteCore | ||
* @author Romain RUAUD <[email protected]> | ||
* @copyright 2020 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
--> | ||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> | ||
<body> | ||
<referenceContainer name="footer"> | ||
<referenceContainer name="legal"> | ||
<referenceContainer name="legal.system"> | ||
<block class="Smile\ElasticsuiteCore\Block\Adminhtml\System\Version" after="version" name="es-version" as="es-version" /> | ||
</referenceContainer> | ||
</referenceContainer> | ||
</referenceContainer> | ||
</body> | ||
</page> |
21 changes: 21 additions & 0 deletions
21
src/module-elasticsuite-core/view/adminhtml/templates/system/version.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
/** | ||
* Version footer block | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteCore | ||
* @author Romain Ruaud <[email protected]> | ||
* @copyright 2022 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
?> | ||
<p class="magento-version"> | ||
<strong><a href="https://elasticsuite.io"><?= $block->escapeHtml(__('ElasticSuite')) ?></a></strong> | ||
<?= $block->escapeHtml($block->getElasticsuiteEdition()) ?> | ||
<?= $block->escapeHtml(__('ver. %1', $block->getElasticsuiteVersion())) ?> | ||
</p> |