Project

General

Profile

Bug #24124 » 16465_tce_optgroup.patch

Administrator Admin, 2010-11-18 12:16

View differences:

t3lib/class.t3lib_tceforms.php (working copy)
if (!($p[1] != $PA['itemFormElValue'] && is_array($uniqueIds) && in_array($p[1], $uniqueIds))) {
if(!strcmp($p[1],'--div--')) {
$optGroupStart[0] = $p[0];
$optGroupStart[1] = $styleAttrValue;
if ($config['iconsInOptionTags']) {
$optGroupStart[1] = $this->optgroupTagStyle($p[2]);
} else {
$optGroupStart[1] = $styleAttrValue;
}
} else {
if (count($optGroupStart)) {
......
}
/**
* Creates style attribute content for optgroup tags in a selector box, primarily setting it up to show the icon of an element as background image (works in mozilla)
*
* @param string Icon string for option item
* @return string Style attribute content, if any
*/
function optgroupTagStyle($iconString) {
if ($iconString) {
list($selIconFile,$selIconInfo) = $this->getIcon($iconString);
$padLeft = $selIconInfo[0]+4;
if($padLeft >= 18 && $padLeft <= 24) {
$padLeft = 22; // In order to get the same padding for all option tags even if icon sizes differ a little, set it to 22 if it was between 18 and 24 pixels
}
$padTop = t3lib_div::intInRange(($selIconInfo[1]-12)/2,0);
$styleAttr = 'background: #fff url(' . $selIconFile . ') 0 0 no-repeat; padding-top: ' . $padTop . 'px; padding-left: ' . $padLeft . 'px;';
return $styleAttr;
}
}
/**
* Extracting values from a value/label list (as made by transferData class)
*
* @param string Value string where values are comma separated, intermixed with labels and rawurlencoded (this is what is delivered to TCEforms normally!)
(3-3/3)