I am working on a custom module based on ISBN2node that extends it for a specific content type on my site. ISBN2node is at https://github.com/leeksoup/ISBN2node

The point I'm confused about is regarding the functions for isbnreview_title_form, which are defined in isbn2node.module. There is a form builder function (isbnreview_title_form) and a submit handler (isbnreview_title_form_submit) but no validate function. This form begins with the user entering some keywords, and once those are submitted, it rebuilds the form with a list of book options for the user to choose from. Then once the user picks one and hits "Fetch" (the submit button), the module goes off and fetches the book data from the selected DB and populates a node add form.

What I don't understand is, what makes it go from the Fetch submit to the node add form? Where is it specified where to go/ what to do after this submit button is pressed?

For that matter, I don't see how the data for the selected option ends up in the node add form. I see that the isbnreview_form_alter  hook implementation populates the form, but it's pulling the data from where it is saved in the config settings, but I only see it getting saved in isbnreview_add_form_submit (for an ISBN search, not a title/keyword search) and isbnreview_add_manual (which saves only the ISBN for a manual node entry). It is not saved in the isbn2node_title_form* functions.

Help?

Accepted answer

Figured it out. Both the builder and submit handler functions have two conditional blocks. One block happens on the first pass through the form, and the other block on the second pass. The submit handler sets up rebuild values for the form at the end of the first pass,  which sends it to the builder again, and then its value gets sent to the other part of the submit handler when the user hits submit.

Also, unrelatedly, the block styles aren't working for me (grayed out) today in the Forum's CKE plugin.

Most helpful answers

A Google search turns up this:

https://xdebug.org/docs/dbgpClient

which is a command line client in the xdebug site. Never used it. 

Personally, I'd switch to an IDE. So many benefits, including automatic doc lookup, code suggestions, linting and code sniffer. 

Great to know you figured it out. I have found the step debug provided by xdebug essential when you want to figure out the flow of things. I use Visual Studio Code as my IDE and the PHP Debug extension.

And BTW: I reported the issue with the Forum CKE5. I hope it gets fixed soon.

Comments

Figured it out. Both the builder and submit handler functions have two conditional blocks. One block happens on the first pass through the form, and the other block on the second pass. The submit handler sets up rebuild values for the form at the end of the first pass,  which sends it to the builder again, and then its value gets sent to the other part of the submit handler when the user hits submit.

Also, unrelatedly, the block styles aren't working for me (grayed out) today in the Forum's CKE plugin.

Great to know you figured it out. I have found the step debug provided by xdebug essential when you want to figure out the flow of things. I use Visual Studio Code as my IDE and the PHP Debug extension.

And BTW: I reported the issue with the Forum CKE5. I hope it gets fixed soon.

I am really old school and use vim as my primary code editor. :) Can I use xdebug without an IDE?

Thanks for reporting the forum issue.

A Google search turns up this:

https://xdebug.org/docs/dbgpClient

which is a command line client in the xdebug site. Never used it. 

Personally, I'd switch to an IDE. So many benefits, including automatic doc lookup, code suggestions, linting and code sniffer.