This question may be related to a resolved thread.
I’ve just looked at the code of the videoplugin extension and noticed that I use the comment_entries_comment_format hook. After playing with the other hook - comment_entries_tagdata - I came to the conclusion, that whenever I use a comment hook. I need to do all the formatting actions within the plugin. In both cases no formatting had been applied. Is that true? Can I call standard functions of the EE framework to do the formatting?
best Lars
From a quick look- don’t see why it should end the regular processing unless you’re using end_script. At least with the tagdata hook. Take a look at the code- if you’re using that extension, should allow you to tweak the tagdata as needed- then send it back with tweaks intact- and allow it to finish just as it would w/no hook. At least in that one. end_script would be a different story- it would just return it when the extension was done doing its thing. Could that be in play?
Also- going to shift to the extensions forum where this is a better fit.
$tagdata = $TMPL->tagdata;
// -------------------------------------------
// 'comment_entries_tagdata' hook.
// - Modify and play with the tagdata before everyone else
//
if ($EXT->active_hook('comment_entries_tagdata') === TRUE)
{
$tagdata = $EXT->call_extension('comment_entries_tagdata', $tagdata, $row);
if ($EXT->end_script === TRUE) return $tagdata;
}
I still have a bit of a problem of understanding the comment_entries_tagdata hook.
$tagdata holds the template for a single comment with all its tags. So I can manipulate the template, add variables or just make it look differently.
$row holds an array with all information about the actual comment.
The function needs to return $tagdata, which means the template data with the template tags. So how do I modify the comment text with this function in order to include the video embed.
I tried the following (I take the row[‘comment’] and do the modifications to the text and then replace the variable in $tagdata, which is then returned):
function renderHTMLCodeComment($tagdata, $row)
{
global $TMPL;
$comment = $row['comment'];
// do the modifications
return $TMPL->swap_var_single('comment', $comment, $tagdata);
}
But as I remove the {comment} variable, it isn’t processed anymore and hence no formatting is done anymore.
If I use the comment_entries_comment_format I can modify the comment itself, but no formatting is done afterwards either.
function renderHTMLCodeComment($comment_row)
{
$comment = $comment_row['comment'];
// do the modifications
return $comment;
}
So can anyone suggest a solution? How to add the standard formatting to the functions within the extension? Thanks..
best Lars
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.