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

Cant get a drupal_get_form to work with _menu hook callback function

Hi all,

I am using Drupal 4.7. I have a the following problem. I have defined a _menu hook function that displays a "add" tab. When clicked, the add tab should call a function that returns a form. I need to use drupal_get_form to generate the form. However when I do this I just get errors (see below). It seems the framework goes into a endless loop. There seems to be a problem with the $fomr[#parents] variable but I do not defined this myself and I am at a loss on how to fix it. I have googled and only found this (http://drupal.org/node/119621) would did not help.

sample code:
=========

<?php
function my_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array( 'path' => 'admin/content/my',
'title' => t('videos'),
'access' => user_access('edit own'),
'callback'=>'my_list');
$items[] = array( 'path' => 'admin/content/my/list',
'title' => t('list'),
'access' => user_access('edit own'),
'type' => MENU_DEFAULT_LOCAL_TASK);
$items[] = array( 'path' => 'admin/content/my/add',
'title' => t('add'),
'access' => user_access('edit own'),
'callback'=>'my_add',
'type' => MENU_LOCAL_TASK);
}
return $items;
}

function my_add($id=-1) {
$my=array();
if ($id!=-1){
$my = get_my($id);
}
$form['my']['file_name'] = array(
'#type' => 'file',
'#title' => t('File'),

Views trouble

I've incorporated the views module in hopes to recreate a site for my company. The way the site works is it has one featured article on the home page accompanied by a large picture.

Well, I took this approach:

Help with php code implementation

ok... I posted this originally in the wrong forum. This proving that I'm kind of a Drupal Newb!

I want to create a input box that takes you to a URL based on what you type into the input box. Reason for use: I want to create several galleries that are "hidden", but you can get there when you type in the gallery (which in turn will be the redirect URL path. I'm not a coder, so I don't totally know how to make this work. A friend gave me some code to try out:

User Form API W/ Images

Below is the code I am working on to extend the user form via _user hook. I am new to drupal but the form API seems str forward enough. However I am a little stuck on how to add non form elements in the array. For example I would like to be able to add a image (link pulled from DB) and display it above the 'user_pro_image' element (see below for comments). Any input is welcome

Code:
<?php
$fields['user_ext_info'] = array( '#type' => 'fieldset', '#title' => t('Winery Info') );
/* Image Item Goes Here */
$fields['user_ext_info']['user_pro_image'] = array('#title' => t('Profile Image'),'#type' => 'file');
$fields['user_ext_info']['user_address'] = array('#title' => t('Address'),'#type' => 'textfield');
$fields['user_ext_info']['user_phone'] = array('#title' => t('Phone'),'#type' => 'textfield');
$fields['user_ext_info']['user_website'] = array('#title' => t('Website'),'#type' => 'textfield');
$fields['user_ext_info']['user_hours'] = array('#title' => t('Regular Hours'),'#type' => 'textfield');
$fields['user_ext_info']['user_tasting_fee'] = array(
'#title' => t('Tasting Fee'),
'#type' => 'radios',
'#default_value' => 'No',
'#options' => array(t('Yes'), t('No') )
);
$fields['user_ext_info']['user_fee'] = array('#title' => t('Tasting Fee'),'#type' => 'textfield', '#description' => 'leave blank if no fee');

The magic of pager_query: how does it work?

Ok, I've set up my first function using pager_query. Problem is, it works. Or rather, the problem is, I don't know _why_ it works and it bugs me. :)

A page containing a function automatically executes a query using pager_query. The function makes use of an URL parameter which it puts into the query. The function creates output which includes text not in the query. Then first page of results - using theme ('pager',...) - is printed on the screen along with the pager and I understand how that works.

Altering Autostart on Video Divx Player

Hi

I have just installed the video module. I am surprised that it plays DivX without any alterations. Only thing is I would like to disable the autostart. If possible I would like to embed the customized Stage6 player. I have located this code in the video.module file:

/**
* Play videos from in DivX format
*
* @see http://developer.apple.com/internet/ieembedprep.html
* @param $node
* object with node information
*
* @return
* string of content to display
*/
function theme_video_play_divx($node) {
//Increase the height to accommodate the player controls on the bottom.
$height = $node->videoy + 20;

$url = _video_get_fileurl($node->vidfile);

$output = '

videox.'" height="'.$height.'" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab"> '. "\n"; // this will be executed by not Internet Explorer browsers $output = ' videox.'" height="'.$height.'" mode="zero"> '."\n"; $output .= ''."\n"; $output .= ''."\n"; $output .= '

';
$output = _theme_video_format_play($output,t('http://www.divx.com/divx/webplayer/'),
t('Link to DivX Download Page'),

Pages

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