Fix helplink

This commit is contained in:
Thomas Peterson 2022-06-28 14:43:37 +02:00
parent 7c1adb2aba
commit 02595c339e
4 changed files with 26 additions and 10 deletions

View File

@ -28,6 +28,9 @@ class Base
if(isset($this->node['help'])) { if(isset($this->node['help'])) {
$this->element->setHelp((string)$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) { if(isset($this->node['exportAjax']) && (string)$this->node['exportAjax'] == 1) {
$this->element->setIsAjaxExport(true); $this->element->setIsAjaxExport(true);
} }

View File

@ -17,7 +17,9 @@ class Base
protected $default = null; protected $default = null;
/** @var string $help */ /** @var string $help */
protected $help = ''; protected ?string $help = null;
protected ?string $helpLink = null;
/** @var boolean $require */ /** @var boolean $require */
protected $require = false; protected $require = false;
@ -144,22 +146,26 @@ class Base
$this->default = $default; $this->default = $default;
} }
/** public function getHelp(): string
* @return string
*/
public function getHelp()
{ {
return $this->help; return $this->help;
} }
/** public function setHelp(string $help): void
* @param string $help
*/
public function setHelp($help)
{ {
$this->help = $help; $this->help = $help;
} }
public function setHelpLink(string $var): void
{
$this->helpLink = $var;
}
public function getHelpLink(): string
{
return $this->helpLink;
}
/** /**
* @return string * @return string
*/ */

View File

@ -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 public function testMaxBreite(): void
{ {
$article = $this->engine->getArticle(); $article = $this->engine->getArticle();

View File

@ -52,7 +52,7 @@
<opt id="9" name="Freies Format"></opt> <opt id="9" name="Freies Format"></opt>
</option> </option>
<option id="breite_frei" name="Breite (in mm)" type="Input" default="100" min="30" max="480" helplink="/cms/breitaufkl?show=2&amp;help=1"> <option id="breite_frei" name="Breite (in mm)" type="Input" default="100" min="30" max="480" help="Hello World" helplink="cms/test">
<format1> <format1>
<grenze>9</grenze> <grenze>9</grenze>
</format1> </format1>