Popups have come so much into fashion, of late, and thus appealed to customers' sentiment that the public are starting growing more and more convinced: an ideal site has to be in popups. Whareas the module Popups API for Drupal 6 have so far hit the market, it's by no means the case with Drupal 7. Yet, it is much to the credit of Earl Milesthat we have presently acquired a very handy instrument Ctools — the module that has turned to be a powerful API for drupal developers. In this post, only a small portion of the Tools capabilities will be discussed, namely, the modal API.
Let's have a look at one isolated instance, and that is, adding reviews to current news. In the meantime, just bear in mind the following: 1/ news and reviews are considered as two separate types of content: 2/ there is a block with a “Add review” link available on the news page.
First, a hook_menu page needs to be announced to which ajax will , eventually, be addressing. Secondly, a callback for the declared page should be written out and the block that contains the “Add review” link should be added afterwards. That's it. You also keep in mind that the default value "node reference" for the field in hook_form_alter () is to be set (one can't skip it).