2

I have what one could consider an "irregularity" in a Drupal module. I have this unique case (mostly due to vendor inconsistencies and ever-changing requirements) where when a user requests a certain item (in this case, something from an inventory database), a hook_menu() call routes them to a callback that polls the inventory API (a REST service), and we pass that REST data to the user through a theme call in Drupal. Attempts to actually display the data directly to the browser are mostly unsuccessful due to CORS issues, and nobody is answering the phone at the vendor.

I've been informed there are some additional requirements that require our newly minted psuedo-content to host a "Comments" section, which if my knowledge of the CMS is clear, only associates with items the system is storing, e.g Entities and Nodes. Before I ask about a definitive solution, I should ask, if there is any way to convince the CMS otherwise, and track a comments record for this faux-content, or if my only option is to save this data as a node (even if its just a single field), and then 301 Redirect to it once saved. Any thoughts? I know this is a rather abstract question with an equally abstract solution, but time constraints make longer-term solutions unobtainable for now.

0

Well, I think you pretty much have the answer.

Handling comments without the help of the Node API would probably be a lot of work.

But if you don't need all the extra features the Node layer brings, you can try to apply the same method on an entity. The Reply module takes care of attaching comments to your entity type.

Again, it's more work than simply using a node to store each item comments section. Just use your callback function to load or create a node with a field storing the item ID (if it doesn't exist yet on the database).

You can then use drupal_goto('node/' . $nid, array(), 301) to redirect the user to the comments page.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.