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

mailhandler and listhandler for 4.7

Hi. I want to get mailhandler and listhandler functional for 4.7. I use Apache2 , Mysql 4.1 . I'm new to Drupal. My site needs these badly. For me, these seem to be very close to functioning. I've searched and can not find any recent activity on these . I'm posting here in hopes of someone already having patches for these or is working on this and could use help or having good advice or wanting to help.

can't use ?foo=bar in a module....

so I wanted to remove some of my code from a module and put it in another php file and include it in the main module file like this include('file.php?foo=bar'); so I can pass a variable named foo into file.php

when I try this I get a No such file or directory warning, but when I change it to: include('file.php'); it's works fine but then obviously there's no variable getting passed

it seems that Drupal won't let the module use a url query string for some reason, is there any way around this?

can't use ?foo=bar in a module....

so I wanted to remove some of my code from a module and put it in another php file and include it in the main module file like this include('file.php?foo=bar'); so I can pass a variable named foo into file.php

when I try this I get a No such file or directory warning, but when I change it to: include('file.php'); it's works fine but then obviously there's no variable getting passed

it seems that Drupal won't let the module use a url query string for some reason, is there any way around this?

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?

Pages

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