XF 2.1 How to add something to the list of $unapprovedItems

SneakyDave

Well-known member
I thought this would be easy, but even with PHPStorm I can't figure out how this code works.

All I'm trying to do is add an additional column from the thread, or post, tables to the list of items displayed on the Approval Queue page.

I thought I'd copy the approval_queue for my own needs, and extend the XF/Pub/Controller/ApprovalQueue to provide the template what I need from the thread/post.

But in the approval_queue template, there is some raw code in there which I can't interpret. This appears to display information about the unapproved content type:
PHP:
{$unapprovedItem.getHandler().render($unapprovedItem)|raw}

I assume that I need to find a Thread or a Post render() method(?) and see what columns from the database it is pulling, and add my own. Where would I begin to look? Would this be in the Thread or Post Entity classes? Is this some kind of ajax request that makes it harder than it would seem?
 
There are different classes for different content types which may appear in the Approval Queue - they all extend XF\ApprovalQueue\AbstractHandler, which contains the render function.

So if you look at the individual content based classes in the same folder - you'll see how they generate the data for display.

In particular, the getTemplateData routine from the AbstractHandler is used by all classes except the User class - which overrides this with its own implementation.

The XFMG and XFRM addons both create additional Approval Queue handlers as well.

So the code you have copied from the template looks at the array of unapproved items, then for each item - gets the handler (based on content type) and then calls the render function for that handler and displays the raw output (the render function will output HTML code to display the item in the queue).
 
Back
Top Bottom