我有TYPO3 7.6.18而且我遇到了问题,我的addCommentAction
无效/无法调用。
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
"MyVendor.".$_EXTKEY,
'commentForm',
'Comment form'
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'MyVendor.'.$_EXTKEY,
'commentForm',
array('Comment' => 'form,addComment'),
array('Comment' => 'form,addComment')
);
<f:form action="addComment" object="{newComment}" name="newComment" method="post" additionalParams="{showUid: userto}">
<div style="overflow: hidden;">
<div id="reviewStars-input">
<f:form.hidden property="userto" value="{userto}"/>
<f:form.radio property="rating" value="5" id="star-4"/>
<label title="{f:translate(key: 'tx_fecomments_domain_model_comment.gorgeous')}" for="star-4"></label>
<f:form.radio property="rating" value="4" id="star-3"/>
<label title="{f:translate(key: 'tx_fecomments_domain_model_comment.good')}" for="star-3"></label>
<f:form.radio property="rating" value="3" id="star-2"/>
<label title="{f:translate(key: 'tx_fecomments_domain_model_comment.regular')}" for="star-2"></label>
<f:form.radio property="rating" value="2" id="star-1"/>
<label title="{f:translate(key: 'tx_fecomments_domain_model_comment.poor')}" for="star-1"></label>
<f:form.radio property="rating" value="1" id="star-0"/>
<label title="{f:translate(key: 'tx_fecomments_domain_model_comment.bad')}" for="star-0"></label>
</div>
</div>
<div>
<f:form.textfield style="height: 100px;" property="text"/>
<br>
<f:form.submit class="btn btn-primary" value="{f:translate(key: 'tx_fecomments_domain_model_comment.send_comment')}"/>
</div>
</f:form>
/**
* @param \MyVendor\Fecomments\Domain\Model\Comment $newComment
* @return bool
*/
public function addCommentAction(\MyVendor\Fecomments\Domain\Model\Comment $newComment)
{
die(8979);
}
当我点击“发送表格”时,没有任何反应。我不知道为什么。似乎没有调用addComment
动作。在我的其他扩展中类似的代码正常工作。当我点击“发送表单”时,我有下一个网址site.en/?showUid=1&tx_fecomments_commentform%5Baction%5D=addComment&tx_fecomments_commentform%5Bcontroller%5D=Comment&cHash=236d87f2ee987ddf7b5720ae5ddc029e
它必须有效,所以我不知道为什么它不起作用。请帮帮我,我真的没有任何想法。
这也是我的评论模型:
namespace MyVendor\Fecomments\Domain\Model;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
class Comment extends AbstractEntity {
/**
* @var string
**/
protected $text = '';
/**
* user
*
* @var \Fhk\Feusersplus\Domain\Model\User
*/
protected $userfrom;
/**
* user
*
* @var \Fhk\Feusersplus\Domain\Model\User
*/
protected $userto;
/**
* @var int
**/
protected $crdate;
/**
* @var int
**/
protected $rating;
/**
* @param int $userfrom
*/
public function setUserfrom($userfrom) {
$this->userfrom = (int)$userfrom;
}
/**
* @return \Fhk\Feusersplus\Domain\Model\User
*/
public function getUserfrom() {
return $this->userfrom;
}
/**
* @param int $userto
*/
public function setUserto($userto) {
$this->userto = (int)$userto;
}
/**
* @return \Fhk\Feusersplus\Domain\Model\User
*/
public function getUserto() {
return $this->userto;
}
/**
* @param int $crdate
*/
public function setCrdate($crdate) {
$this->userto = (int)$crdate;
}
/**
* @param int $rating
*/
public function setRating($rating) {
$this->rating = (int)$rating;
}
/**
* @return int
*/
public function getCrdate() {
return $this->crdate;
}
/**
* @return int
*/
public function getRating() {
return $this->rating;
}
/**
* @param $text
*/
public function setText($text) {
$this->text = (string)$text;
}
/**
* @return string
*/
public function getText() {
return $this->text;
}
}
答案 0 :(得分:0)
我解决了我的问题。我的TCA没有定义字段'评级'。