I'm trying to put a page together with the moodleform class that has input and textarea elements all over, in different [Bootstrap] columns. The way moodleform (i.e. quickform) displays is pretty much a vertical list style, but I'm trying to figure out how to extend the class to allow different positioning. Any tips on functions I particularly need to override to make this happen, or any other approaches I can take, without having to rewrite any of the form processing and field verification code?
I am not an expert on this. But since you asked this is what have done. I extend the mform class with a function called tablify. I put elements into arrays and put them through the tablify function with a few parameters telling it how to lay them out. I shamefully user html tables for this, but I bet you could do it with nice CSS bootstrap columns. I attached a bit of code I had. Its from a pretty complex mod, and I cut the code back. But you can at least see my approach to it.
Also note that you can add html elements to your forms like this to help with layout.
e.g $mform->addElement('html','<div class="qheader">');
Most form elements can be provided attributes in the fifth parameter to the add_element call. So you would add classes to elements there
e.g $mform->addElement('textarea','atextarea','my text area','wrap="virtual"',array('class'=>'mytextareaclass'));
Hope it helps.
I thought about this and I might end up doing it this way, but there are a few forms I need to set up with the column-based approach, and probably will have more in the future. It would be nice to just have a more flexible framework in general, I think.