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

Customizing Menu Module?

Trying to add an extra field to menu items (an icon field). I added the icon field to menu table and if I manually update menu item in database, the menu item returns with the icon field. However, it doesn't save the icon field from the form.


function menu_form_alter($form_id, &$form) {
// ...
$form['menu']['path'] = array('#type' => 'hidden',
'#value' => $item['path'],
);
// ...
}

function menu_edit_menu_form($mid = 0) {
if (arg(3) == 'edit') {
if (!($item = db_fetch_array(db_query('SELECT * FROM {menu} WHERE mid = %d', $mid)))) {
drupal_not_found();
return;
}
}
else {
$item = array('mid' => 0, 'pid' => 0, 'path' => '', 'weight' => 0, 'type' => MENU_CUSTOM_MENU, 'icon' => '');
}
$form['title'] = array('#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => $item['title'],
'#description' => t('The name of the menu.'),
'#required' => TRUE,
);
$form['mid'] = array('#type' => 'value', '#value' => $item['mid']);
$form['pid'] = array('#type' => 'value', '#value' => $item['pid']);
$form['path'] = array('#type' => 'value', '#value' => $item['path']);
$form['weight'] = array('#type' => 'value', '#value' => $item['weight']);
$form['icon'] = array('#type' => 'value', '#value' => $item['icon']);
$form['type'] = array('#type' => 'value', '#value' => $item['type']);

CNET Style Reviews?

Hey guys. I'm looking for a module that will allow me and my site users to add products to a catalog with pics and a description and then other users can wirite product reviews on the item. Similar in the fashion of Cnet.com. Anyone know of anything like that?

selecting checkboxes


 $form['area'] = array(
      '#type' => 'checkboxes',
      '#title' => 'Area',
      '#default_value' =>  '0',
      '#options' => $options_area,
      '#description' => ''
    );

This is just part of my edit page where I fetch all the information from the database and display it in the form elements. I need to be able to check certain checkboxes according to what was retrieved from the database. I cant seem to find a way to this.

I'm using drupal 4.7

Multiple files in video node?

I'm wondering if the new video module supports multiple file views. The module page suggests it does, but I'm specifically wondering if user can have the ability to choose which format they want to view the file in, after they have chosen a node. Example - a list of nodes will display a video thumbnail, user clicks that, then is asked to choose format. Or, alternatively, they see a default format but are given option to see in different format.

Thanks
Brett Gaylor

homelessnation.org

Warning in User.module

Hi..
when i new user add on my site,in my admin/user throws warning...

problem programmatically creating menu callbacks

I'm trying to programmatically generate team pages, and right now I'm getting weird results. Here's a code snippet from my implementation of hook_menu():

$query = db_query("SELECT tid, name FROM {dm_teams_info}");
while($entry = db_fetch_array($query)) {
  $items[] = array(
    'path' => 'teams/' . $entry['tid'],
    'title' => t($entry['name']),
    'callback' => 'dm_teams_teampage',
    'type' => MENU_CALLBACK,
  );
}

Basically, it takes all of the teams and calls dm_teams_teampage whenever the URL teams/{tid} is called (tid being a number). Right now, dm_teams_teampage simply returns the team number (using arg(1)).

I have three test teams in the DB with tid's 1, 2, and 3. When I call ./teams/1, everything works; ./teams/2 says page not found; ./teams/3 says access denied. Any ideas what's causing this error? Can multiple paths not have the same callback? Thanks!

Pages

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