diff --git a/forms/TableListField.php b/forms/TableListField.php index a288a0b60..b61ef8821 100755 --- a/forms/TableListField.php +++ b/forms/TableListField.php @@ -1478,12 +1478,13 @@ class TableListField_Item extends ViewableData { */ function SelectOptionClasses(){ $tagArray = array('markingcheckbox'); + $options = $this->parent->SelectOptions(); - if(!empty($options)){ - foreach($options as $optionKey => $optionTitle){ - if($optionKey !== 'all' && $optionKey !== 'none'){ - if($this->$optionKey) { - $tagArray[] = $optionKey; + if($options && $options->exists()){ + foreach($options as $option){ + if($option->Key !== 'all' && $option->Key !== 'none'){ + if($this->{$option->Key}) { + $tagArray[] = $option->Key; } } } diff --git a/tests/forms/TableListFieldTest.php b/tests/forms/TableListFieldTest.php index df8e85bff..aeb70e7b2 100755 --- a/tests/forms/TableListFieldTest.php +++ b/tests/forms/TableListFieldTest.php @@ -150,7 +150,6 @@ class TableListFieldTest extends SapphireTest { $table->addSelectOptions(array("F"=>"FieldF")); $tableHTML = $table->FieldHolder(); - $p = new CSSContentParser($tableHTML); $this->assertContains('rel="F"', $tableHTML); $tbody = $p->getByXpath('//tbody');