Posted by amitaibu on April 5, 2009 at 8:10am
I've wrote a small utility module called cck_n_fields, which I'd like to add to d.o. site.
The module allows a user determine the number of multiple fields that should appear in a node add/edit form via URL.
for example: example.com/node/add/story?cck_n_fields[NAME-OF-FIELD]=5 will result with the attached image.
my user case in this module, is that I have a desktop utility that uploads files using CURL.
Do you think the name cck_n_fields is ok? Is it worth a project in d.o. ?
| Attachment | Size |
|---|---|
| snap1.png | 42.26 KB |

Comments
Btw, here's the
Btw, here's the code
<?php/**
* Implementation of hook_form_alter().
*/
function cck_n_fields_form_alter(&$form, &$form_state, $form_id) {
if (!empty($_GET['cck_n_fields']) && strpos($form_id, '_node_form')) {
foreach ($_GET['cck_n_fields'] as $field_name => $value) {
if (empty($form_state['item_count'][$field_name])) {
$form_state['item_count'][$field_name] = intval($value);
}
}
}
}
?>