diff --git a/src/Option/Parser/Base.php b/src/Option/Parser/Base.php index 98b42fc..89012cb 100644 --- a/src/Option/Parser/Base.php +++ b/src/Option/Parser/Base.php @@ -28,6 +28,9 @@ class Base if(isset($this->node['help'])) { $this->element->setHelp((string)$this->node['help']); } + if(isset($this->node['helplink'])) { + $this->element->setHelpLink((string)$this->node['helplink']); + } if(isset($this->node['exportAjax']) && (string)$this->node['exportAjax'] == 1) { $this->element->setIsAjaxExport(true); } diff --git a/src/Option/Type/Base.php b/src/Option/Type/Base.php index f6bcc03..f8e2f51 100644 --- a/src/Option/Type/Base.php +++ b/src/Option/Type/Base.php @@ -17,7 +17,9 @@ class Base protected $default = null; /** @var string $help */ - protected $help = ''; + protected ?string $help = null; + + protected ?string $helpLink = null; /** @var boolean $require */ protected $require = false; @@ -144,22 +146,26 @@ class Base $this->default = $default; } - /** - * @return string - */ - public function getHelp() + public function getHelp(): string { return $this->help; } - /** - * @param string $help - */ - public function setHelp($help) + public function setHelp(string $help): void { $this->help = $help; } + public function setHelpLink(string $var): void + { + $this->helpLink = $var; + } + + public function getHelpLink(): string + { + return $this->helpLink; + } + /** * @return string */ diff --git a/tests/Customer/P/CalcTest.php b/tests/Customer/P/CalcTest.php index 99a5bcb..6432a1c 100644 --- a/tests/Customer/P/CalcTest.php +++ b/tests/Customer/P/CalcTest.php @@ -47,6 +47,13 @@ class CalcTest extends TestCase } + public function testHelpTextAndLink(): void + { + $article = $this->engine->getArticle(); + $this->assertSame("Hello World", $article->getOptionById('breite_frei')->getHelp()); + $this->assertSame("cms/test", $article->getOptionById('breite_frei')->getHelpLink()); + } + public function testMaxBreite(): void { $article = $this->engine->getArticle(); diff --git a/tests/Customer/P/calc.xml b/tests/Customer/P/calc.xml index 406c81e..1659c91 100644 --- a/tests/Customer/P/calc.xml +++ b/tests/Customer/P/calc.xml @@ -52,7 +52,7 @@ -