From 5007de4f390cd1f6ddb0ab5f2f2cf5314abef76e Mon Sep 17 00:00:00 2001
From: andrii-onufriichuk
<117644505+andrii-onufriichuk@users.noreply.github.com>
Date: Mon, 15 May 2023 14:36:15 +0300
Subject: [PATCH] Added plugin version into admin configuration (#28)
* Added plugin version into admin configuration
---
.../System/Config/Form/Field/Version.php | 43 +++++++++++++++++++
Model/Environment/GetEnvironmentVersions.php | 2 +-
etc/adminhtml/system.xml | 4 ++
3 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 Block/Adminhtml/System/Config/Form/Field/Version.php
diff --git a/Block/Adminhtml/System/Config/Form/Field/Version.php b/Block/Adminhtml/System/Config/Form/Field/Version.php
new file mode 100644
index 00000000..3767f0a7
--- /dev/null
+++ b/Block/Adminhtml/System/Config/Form/Field/Version.php
@@ -0,0 +1,43 @@
+environmentVersions = $environmentVersions;
+ parent::__construct(
+ $context,
+ $data
+ );
+ }
+
+ protected function _getElementHtml(AbstractElement $element)
+ {
+ $element->setDisabled('disabled');
+ $element->setValue($this->environmentVersions->getRvvupModuleVersion());
+
+ return $element->getElementHtml();
+ }
+}
diff --git a/Model/Environment/GetEnvironmentVersions.php b/Model/Environment/GetEnvironmentVersions.php
index 5124790a..76c85277 100644
--- a/Model/Environment/GetEnvironmentVersions.php
+++ b/Model/Environment/GetEnvironmentVersions.php
@@ -146,7 +146,7 @@ private function getCachedEnvironmentVersions(): ?string
*
* @return string
*/
- private function getRvvupModuleVersion(): string
+ public function getRvvupModuleVersion(): string
{
// Attempt to figure out what plugin version we have depending on installation method
$packages = $this->composerInformation->getInstalledMagentoPackages();
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index cbf3a177..017f66bf 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -19,6 +19,10 @@
Rvvup\Payments\Block\Adminhtml\CredentialValidator
+
+
+ Rvvup\Payments\Block\Adminhtml\System\Config\Form\Field\Version
+
Rvvup\Payments\Model\Config\Env\Indicator