Taylor J
Well-known member
For the blog addon I've found time to work on again I currently have a "editing" page that is really just the editor on a page with a title input, pretty much a post-thread action without all of the extra stuff like thread types and a few others.
I currently have the below function for the preview action that i ripped from conversations/post-thread/etc but so far nothing happens when I click on preview in the editor.
and template code
With only that above the message variable is coming through as a blank string when stepping through my code with a debugger, so I currently at a point to where I'm unable to test if the preview will actually work.
I do see that in every other instance that the preview bb code is used there is a creator / function to setup a thread/post/conversation. Are these required to get the XF:Editor plugin working so that it can actually grab the message?
I currently have the below function for the preview action that i ripped from conversations/post-thread/etc but so far nothing happens when I click on preview in the editor.
PHP:
public function actionBlogAddPreview(ParameterBag $params)
{
$message = $this->plugin('XF:Editor')->fromInput('message');
return $this->plugin('XF:BbCodePreview')->actionPreview(
$message, 'blog-post', \XF::visitor()
);
}
HTML:
<xf:title>Create a new blog post</xf:title>
<div class="block">
<div class="block-container">
<div class="block-body">
<xf:textboxrow name="title" value="{$title}" rowtype="fullWidth noLabel" class="input--title"
maxlength="40"
placeholder="{{ phrase('title...') }}"
label="{{ phrase('title') }}" />
<xf:editorrow name="message"
value=""
attachments="{{ $attachmentData ? $attachmentData.attachments : [] }}"
rowtype="fullWidth noLabel mergePrev"
data-preview-url="{{ link('userblogs/blog/add-preview', $blogPost) }}" />
<xf:formrow>
<xf:if is="$attachmentData">
<xf:macro template="helper_attach_upload" name="upload_block"
arg-attachmentData="{$attachmentData}"
arg-forceHash="{$draft.attachment_hash}" />
</xf:if>
</xf:formrow>
</div>
</div>
</div>
With only that above the message variable is coming through as a blank string when stepping through my code with a debugger, so I currently at a point to where I'm unable to test if the preview will actually work.
I do see that in every other instance that the preview bb code is used there is a creator / function to setup a thread/post/conversation. Are these required to get the XF:Editor plugin working so that it can actually grab the message?