From 91700a3dac994e964ecb98300b32b4473a90c742 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 15 Oct 2010 02:51:33 +0000 Subject: [PATCH] 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 --- forms/TableListField.php | 11 ++++++----- tests/forms/TableListFieldTest.php | 1 - 2 files changed, 6 insertions(+), 6 deletions(-) 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');