cck_n_fields - good module name?

Amitaibu's picture

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. ?

AttachmentSize
snap1.png42.26 KB
Login to post comments

Btw, here's the

Amitaibu's picture
Amitaibu - Sun, 2009-04-05 08:13

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);
      }
    }
  }
}
?>