protected function getId($fieldId, $fieldName)
{
$id = '';
// If the field is in a group add the group control to the field id.
if ($this->group) {
// If we already have an id segment add the group control as another level.
if ($id) {
$id .= '_' . str_replace('.', '_', $this->group);
} else {
$id .= str_replace('.', '_', $this->group);
}
}
// If we already have an id segment add the field id/name as another level.
if ($id) {
$id .= '_' . ($fieldId ? $fieldId : $fieldName);
} else {
$id .= $fieldId ? $fieldId : $fieldName;
}
// Clean up any invalid characters.
$id = preg_replace('#\\W#', '_', $id);
return $id;
}