Jump to content

hooking comments


Frank Vèssia
 Share

Recommended Posts

Link to comment
Share on other sites

Here is a quick screenshot of an admin page we use to manage the initial hiring process of new employees.

The module hooks into FromBuilder and pulls in entries that are associated with the page. So all the information on the left is from a FormBuilder entry, the sidebar is a little more typical and just made up of the fields assigned to the template. I'll post more about that later.

We don't allow users to edit the comments, because they are part of the document trail, but they have a chance to review them in a modal before the actual submit happens. The "notify of comment" pulls in a list of people with particular roles. 

I'll post the code a little later, I need to put out a small fire first.

post-474-0-79791500-1422373519_thumb.png

  • Like 6
Link to comment
Share on other sites

I'm looking forward to see how to implement the avatars into comments :) Awesome design here.
Did you have the chance to play with the new comments system? I'm trying to show up the votes also but I'm having some issues, they don't display into comments using the options inside the render array. I asked here https://processwire.com/talk/topic/8912-display-votes-on-new-comments-system/

  • Like 1
Link to comment
Share on other sites

Thanks. I do a lot of custom admin pages here. Looking now I have 10 Process Modules that create custom admin functions. Some are simple, some a super complex.

I'll get back here soon with some code examples.


Sevarf2,

Most of the things I've built that use comments were built long before the new comment system.

  • Like 2
Link to comment
Share on other sites

Here are the 2 methods related to comments from the Process Module in the screenshot above.

You can do pretty much the same thing in a template instead of a module. 


Sorry I don't have time to explain further, or put it into a more complete write up. Hopefully you can pick that apart and get what you need.

:)

  • Like 1
Link to comment
Share on other sites

Sorry I don't have time to explain further, or put it into a more complete write up. Hopefully you can pick that apart and get what you need.

Just one small thing, do you use InputfieldMarkup or hooks or some custom fieldtype to inject this stuff into the template?

Link to comment
Share on other sites

That's the beauty of ProcessModules...you can pretty much throw anything at it and it will output it....plain HTML, whatever. I have had a quick look at the code and it's pretty much plain HTML in many places...added to that, some CSS to style it...

  • Like 1
Link to comment
Share on other sites

LostKobrakai,

Forgot to mention, the reason it's all returning markup is that when I build the form, the comments get added like so:

// Comments
$field = $this->modules->get("InputfieldMarkup");
$field->markupText = $this->renderComments($page);
$form->add($field);
  • Like 1
Link to comment
Share on other sites

Here is a paste that shows how the entire sidebar gets built. 

There's really nothing too fancy here. Pulling in specific FormBuilder entries and allowing edits that in turn update the associated page gets a little fancier, but nothing all that complicated really.


There are certainly other ways to build that sidebar, but I needed to have a lot of control over the settings, and the template has a lot of other fields that are specific to another part of the process, so I can't just foreach the fields.

  • Like 1
Link to comment
Share on other sites

  • 7 months later...
  • 5 months later...

Here are the 2 methods related to comments from the Process Module in the screenshot above.

Here is a paste that shows how the entire sidebar gets built. 

Hey renobird, the content in both pastebin links seem to have been removed. Any change you can upload them (again)? Maybe a gist?

Link to comment
Share on other sites

Hey renobird, the content in both pastebin links seem to have been removed. Any change you can upload them (again)? Maybe a gist?

Hi arjen,

I'll dig those up again. Not sure why I would have put an expiration on the pastes. 

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...