/** * Overrides CqQuestionAbstract::handleNode() */ public function handleNode($node, $delay = FALSE) { $answer = $this->userAnswer->getAnswer(); $retval = ''; if (drupal_strtolower($node->nodeName) == 'inlinechoice') { $choice = array(); $attribs = $node->attributes; $item = $attribs->getNamedItem('identifier'); if ($item === NULL) { $item = $attribs->getNamedItem('id'); } if ($item !== NULL) { $choiceid = $item->nodeValue; } else { if (user_access(CLOSEDQUESTION_RIGHT_CREATE)) { drupal_set_message(t('Warning: inlinechoice without identifier.'), 'warning'); } $choiceid = 'noId'; } $choice['id'] = $choiceid; $freeform = $node->attributes->getNamedItem('freeform'); $style = $node->attributes->getNamedItem('style'); $groupItem = $node->attributes->getNamedItem('group'); if ($groupItem == NULL || empty($groupItem->nodeValue)) { $choice['group'] = 'default'; } else { $choice['group'] = $groupItem->nodeValue; } if (!isset($this->inlineOptionsByGroup[$choice['group']])) { $choice['group'] = 'default'; } if ($style != NULL) { $choice['style'] = $style->nodeValue; } $class = $node->attributes->getNamedItem('class'); if ($class != NULL) { $choice['class'] = $class->nodeValue; } $choice['name'] = '' . $this->formElementName . '[' . $choiceid . ']'; $choice['size'] = 8; $sizeAtt = $node->attributes->getNamedItem('size'); if ($sizeAtt != NULL) { $choice['size'] = $sizeAtt->nodeValue; } $choice['value'] = $answer[$choiceid]; $choice['freeform'] = 0; if ($freeform != NULL && $freeform->nodeValue) { $choice['freeform'] = $freeform->nodeValue; } if (!$choice['freeform']) { $choice['options'] = $this->inlineOptionsByGroup[$choice['group']]; } $this->inlineChoices[$choiceid] = $choiceid; $retval = theme('closedquestion_inline_choice', $choice); } else { $retval = parent::handleNode($node, $delay); } return $retval; }