Merged revisions 32182 via svnmerge from

svn://svn.silverstripe.com/silverstripe/modules/sapphire/branches/2.0-nzct

........
  r32182 | ischommer | 2007-03-14 23:34:50 +1300 (Wed, 14 Mar 2007) | 1 line
  
  More versatile character-replacing for css-classes
........


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@52775 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-04-15 09:21:45 +00:00
parent ce8bf58b0d
commit 12c3ab559f

View File

@ -44,7 +44,7 @@ class OptionsetField extends DropdownField {
$odd = ($odd + 1) % 2; $odd = ($odd + 1) % 2;
$extraClass = $odd ? "odd" : "even"; $extraClass = $odd ? "odd" : "even";
$extraClass .= " val" . str_replace(' ','',$key); $extraClass .= " val" . preg_replace('/[^a-zA-Z0-9\-\_]/','_', $key);
$disabled = $this->disabled ? 'disabled="disabled"' : ''; $disabled = $this->disabled ? 'disabled="disabled"' : '';
$options .= "<li class=\"".$extraClass."\"><input id=\"$itemID\" name=\"$this->name\" type=\"radio\" value=\"$key\"$checked $disabled/> <label for=\"$itemID\">$value</label></li>\n"; $options .= "<li class=\"".$extraClass."\"><input id=\"$itemID\" name=\"$this->name\" type=\"radio\" value=\"$key\"$checked $disabled/> <label for=\"$itemID\">$value</label></li>\n";