BUGFIX: updated select options classes to work with the dataobjectset returned by selectoptions rather than the array previously (from r105872)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112504 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-10-15 02:51:33 +00:00
parent 092a3c1c26
commit 91700a3dac
2 changed files with 6 additions and 6 deletions

View File

@ -1478,12 +1478,13 @@ class TableListField_Item extends ViewableData {
*/ */
function SelectOptionClasses(){ function SelectOptionClasses(){
$tagArray = array('markingcheckbox'); $tagArray = array('markingcheckbox');
$options = $this->parent->SelectOptions(); $options = $this->parent->SelectOptions();
if(!empty($options)){ if($options && $options->exists()){
foreach($options as $optionKey => $optionTitle){ foreach($options as $option){
if($optionKey !== 'all' && $optionKey !== 'none'){ if($option->Key !== 'all' && $option->Key !== 'none'){
if($this->$optionKey) { if($this->{$option->Key}) {
$tagArray[] = $optionKey; $tagArray[] = $option->Key;
} }
} }
} }

View File

@ -150,7 +150,6 @@ class TableListFieldTest extends SapphireTest {
$table->addSelectOptions(array("F"=>"FieldF")); $table->addSelectOptions(array("F"=>"FieldF"));
$tableHTML = $table->FieldHolder(); $tableHTML = $table->FieldHolder();
$p = new CSSContentParser($tableHTML); $p = new CSSContentParser($tableHTML);
$this->assertContains('rel="F"', $tableHTML); $this->assertContains('rel="F"', $tableHTML);
$tbody = $p->getByXpath('//tbody'); $tbody = $p->getByXpath('//tbody');