Form api (4.7)

morphir - February 28, 2006 - 07:17

Iam updating the flexiblock for 4.7 here. But I get this error:

Fatal error: Call to undefined function form_checkbox() in www.myserver.tld\cvs\modules\flexiblock.module on line 141

I've red about the form api, but i dont understand much of it to be quite honest...so all help would be most appreciated!

These are the 6 lines I need to convert:

     
form_checkbox(NULL, $block['module'] .']['. $block['delta'] .'][status', 1, $block['status']),
form_weight(NULL, $block['module'] .']['. $block['delta'] .'][weight', $block['weight']),
form_select(NULL, $block['module'] .']['. $block['delta'] .'][region', $block['region'],
$row[] = form_checkbox(NULL, $block['module'] .']['. $block['delta'] .'][throttle', 1, $block['throttle']);
$row[] = form_select(NULL, $block['module'] .']['. $block['delta'] .'][flexi', $_mapping, $select_mapping);
$output .= form_submit(t('Save blocks'));

Cheers!

Form Updater

asterix - March 10, 2006 - 02:36

I've been using this to get a headstart on converting my 4.6 modules to 4.7 : http://drupal.org/node/37457. You don't even need to install it - basically you simply plug in the entire module code, in your case from flexiblock.module, hit submit, and formupdater will spit out the code snippets that need replacing and the code to replace them with. I've made these changes to the following mods:

article, arooga, fckeditor, im, chatbox, and flexiblock. But that's as far as I get! Next I get the following error:

Fatal error: Cannot create references to/from string offsets nor overloaded objects in drupal\includes\form.inc on line 312.

The problem is apparently not with form.inc but with the module code - it needs to be updated to 4.7's form API, which uses arrays instead of function calls. I plan on reading through this -> http://drupal.org/node/33338 "Upgrading to Forms API" when I get a chance and will post anything I learn.

Meanwhile, there are nodes that are being effectively upgraded, including Nodewords - so it might be worthwhile contacting people that have upgraded modules successfully.

Good luck!
Alex

 
 

Drupal is a registered trademark of Dries Buytaert.