grantus
Active member
I'm wondering what is the correct way to use Xenforo's editor in my own template.
I have this so far in my template:
Then in my controller:
For my entity, I set one up and copied everything from the XF Post entity (and added battle_num) to see what would work. I also created a table, copying the xf_post table.
So far the only issue I'm encountering is that it keeps telling me to enter a valid message. I can see that my message is being sent but nothing is saving.
However, is there an easier way to implement the editor without having to try and copy the xf_post table and XF Post entity?
I have this so far in my template:
Code:
<xf:form action="{{ link('battle/comment', $battle) }}" class="block" ajax="1">
<div class="block-container">
<div class="block-body">
<div class="js-controls">
<xf:editorrow name="message"
rowtype="fullWidth noLabel"
label="{{ phrase('comment') }}" />
<xf:submitrow submit="Save" fa="fa-save" />
</div>
</div>
</div>
</xf:form>
Then in my controller:
Code:
public function actionBattleComment(ParameterBag $params) {
$battle = $this->em()->create('ILL:BattleComments');
$this->battleCommentSaveProcess($battle, $params->battle_num)->run();
}
public function battleCommentSaveProcess(\ILL\Entity\BattleComments $battle, $params->battle_num) {
$input = $this->filter([
'message' => 'str'
]);
$form = $this->formAction();
$form->basicEntitySave($battle, $input);
$form->complete(function() use ($battle, $params->battle_num) {
$battle->battle_num = $params->battle_num;
$battle->save();
});
return $form;
}
For my entity, I set one up and copied everything from the XF Post entity (and added battle_num) to see what would work. I also created a table, copying the xf_post table.
So far the only issue I'm encountering is that it keeps telling me to enter a valid message. I can see that my message is being sent but nothing is saving.
However, is there an easier way to implement the editor without having to try and copy the xf_post table and XF Post entity?