This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

allow user add more fields to form

Here is a very simplified version of one part of my custom content module

$pages = 10;
for ($row=0; $row < $pages; $row ++){
		$thumb_number = "thumb". $row;

		$form[$thumb_number] = array(
			'#type' => 'file', 
			'#title' => t('Thumbnail'),
			'#description' => t('120x80')
		);
}

it add 10 fields to a form, name thumb1, thumb2, thumb3... thumb10

so how can I allow user to define $pages, and thereby control the number of these fields there are in a form?

Side effects on aliased contents when calling menu_set_active_item

I have developed an small module which calls menu_set_active_items to make some nodes to appear as if it were part of a menu section. It works ok, but it has a bad side effect when accessing contents that have an alias: the local tasks tabs are not shown for those contents!

The code of my module (ec_menu) is:

function ec_menu_nodeapi(&$node, $op, $teaser, $page) { 
  switch ($op) {
    case 'view':
      $aliased_path = $_REQUEST['q'];
      ec_menu_set_aliased_active_item($aliased_path);  
      break;
  }
}
function ec_menu_set_aliased_active_item($original_aliased_path) {
  $menu = menu_get_menu();
  $original_unaliased_path = drupal_get_normal_path($original_aliased_path);
  $aliased_path = $original_aliased_path;
  $unaliased_path = $original_unaliased_path;
  $mid = $menu['path index'][$unaliased_path];
  while ($aliased_path && (!array_key_exists($unaliased_path, $menu['path index']) || 
           !($menu['items'][$mid]['type'] & MENU_VISIBLE_IN_TREE))) {
    $aliased_path = substr($aliased_path, 0, strrpos($aliased_path, '/'));
    $unaliased_path = drupal_get_normal_path($aliased_path);
    $mid = $menu['path index'][$unaliased_path];
  }
  menu_set_active_item($unaliased_path);
}

What this code intends to do is to select a menu item with alias 'section_one' when a node with alias path 'section_one/content_a' is visited.

I've read once and again the info on api.drupal.org about the menu system and inspected the code of the menu.module itself. I've also searched the forums for a solution with no luck. Can anyone tell me what I might be doing wrong?

Adding form elements to a multipage form in the pre_render form

I've gotten pretty far through the multipage form documentaiton, and everything seems to be working great so far, but I have one more issue that I can't seem to work out. I've done a quick search through drupal and through the mailing list and have not found anything that will help me so I thought I'd post something here.

My form consists of two pages. Page one has a taxonomy dropdown and a next button. Page two presents different form elements based on the choice made on page one.

Because the number of fields that are presented on the second page and the complex structure of these elements, it seems like it would be cumbersome to try and load the entire structure for all taxonomy items and only show the one the user selected. It seems like this would be a performance hit as well. As a result, I am looking to generate these items in a different place.

I can generate form elements just fine in my hook_form_alter function, but taxonomy is below my module in the process list and I can't seem to access the value of taxonomy at this point.

I can access the value of the taxonomy item in my form's pre_render function, but when I try to add these new elements I get the proper html structure, but without any ids, form names, etc.

My questions:

1. Am I correct in thinking that the pre_render function is too late in the FAPI flow to properly generate form elements?
2. Is there a way to get the taxonomy's selected term value in my form_alter function?

How do I use liquid wiki?

I got myself the Liquid Wiki module, but I don't know how to use it.
I create a wiki page which seems to be a normal page. The only difference I found out was that I can get to that page on two ways:
-the normal "?q=node"-way
-the "?q=wiki/" way

So what does this module do?
and how does it work?

Where is File Manager module?

I just got acidfree and want to try it out for the first time.
I got it installed; however, to find out I need "File Manager".

I went to the drupal module's page and I don't see "File Manager" for download.

Is this still up?

What happened?
I used Gallery 2 in the past but I like to try this if its more user friendly because the comments for G2 doesn't work unless if you have admin prives.

Google Hosted email module

I would like to found out if anyone else is interested in having a module that will integrate Gmail hosted into drupal.

...maybe to show the Gmail in a frame or something similar.
...and pass-through authentication from drupal, so only one login is required.

If you like the idea of such a module, or have any additional input - please post a comment here

Thanks
jacauc

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions