diff --git a/Admin/BaseFieldDescription.php b/Admin/BaseFieldDescription.php index 2874aa401f..408a47871e 100644 --- a/Admin/BaseFieldDescription.php +++ b/Admin/BaseFieldDescription.php @@ -190,6 +190,7 @@ public function setOption($name, $value) * Define the options value, if the options array contains the reserved keywords * - type * - template + * - help * * Then the value are copied across to the related property value * @@ -210,6 +211,12 @@ public function setOptions(array $options) unset($options['template']); } + // set help if provided + if (isset($options['help'])) { + $this->setHelp($options['help']); + unset($options['help']); + } + $this->options = $options; } @@ -475,4 +482,4 @@ public function getLabel() { return $this->getOption('label'); } -} \ No newline at end of file +} diff --git a/Tests/Admin/BaseFieldDescriptionTest.php b/Tests/Admin/BaseFieldDescriptionTest.php index 61d8b960ce..6df345218c 100644 --- a/Tests/Admin/BaseFieldDescriptionTest.php +++ b/Tests/Admin/BaseFieldDescriptionTest.php @@ -49,10 +49,11 @@ public function testOptions() $this->assertEquals('trucmuche', $description->getLabel()); $this->assertNull($description->getTemplate()); - $description->setOptions(array('type' => 'integer', 'template' => 'foo.twig.html')); + $description->setOptions(array('type' => 'integer', 'template' => 'foo.twig.html', 'help' => 'fooHelp')); $this->assertEquals('integer', $description->getType()); $this->assertEquals('foo.twig.html', $description->getTemplate()); + $this->assertEquals('fooHelp', $description->getHelp()); $this->assertCount(0, $description->getOptions());