Skip to content

Commit

Permalink
Merge pull request #484 from stewe/master
Browse files Browse the repository at this point in the history
Adding 'help' as reserved key for FieldDescription
  • Loading branch information
rande committed Jan 10, 2012
2 parents 2fe36ec + db25866 commit 16fbf45
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Admin/BaseFieldDescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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;
}

Expand Down Expand Up @@ -475,4 +482,4 @@ public function getLabel()
{
return $this->getOption('label');
}
}
}
3 changes: 2 additions & 1 deletion Tests/Admin/BaseFieldDescriptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit 16fbf45

Please sign in to comment.