Closed tobiasschaeferptb closed 5 years ago
I do not have a working example in V 6.x using matrix or matrix header (l used this type last time 6 Years Ago and forgot how i worked then) the viewhelper itself looks strange to me as it is used in the partial martixRow and matrixHeader with the same argument 'answer' that will explain the error message. But inside of the renderFunction the agrument type matrixrow is not renderd: only matrixHeader and extendedMatrixHeader
But maybe cahngeing the viewhelper: www/http/typo3conf/ext/ke_questionnaire/Classes/ViewHelpers/MatrixRowViewHelper.php
with the code below helps .. if yes, i can check it in ..
`<?php namespace Kennziffer\KeQuestionnaire\ViewHelpers; /***
/* *
*/ class MatrixRowViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
/**
/**
/**
/**
@return string */ public function render( ) { $answer = $this->arguments['answer'] ; $question = $this->arguments['question'] ; $as = $this->arguments['as'] ;
if (get_class($answer) == 'Kennziffer\KeQuestionnaire\Domain\Model\AnswerType\MatrixHeader' OR get_class($answer) == 'Kennziffer\KeQuestionnairePremium\Domain\Model\AnswerType\ExtendedMatrixHeader'){ $rows = $answer->getRows($question);
$templateVariableContainer = $this->renderingContext->getVariableProvider();
if ($question === NULL) {
return '';
}
$output = '' ;
foreach ($rows as $nr => $element){
$templateVariableContainer->add($as, $element);
$output .= $this->renderChildren();
$templateVariableContainer->remove($as);
}
}
return $output;
}
}`
okay, found it: the type should be 'mixed'
see latest version
If I use the answer type Matrix header it leads to this exception: The argument "answer" was registered with type "Kennziffer\KeQuestionnaire\Domain\Model\AnswerType\MatrixRow", but is of type "Kennziffer\KeQuestionnaire\Domain\Model\AnswerType\MatrixHeader"