Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
I have a module where I want to pass a variable from a form to the form theme function. The theme function is defined in the form with $form['#theme'] = 'theme_MYMODULE_form'. The code is as follows:
function MYMODULE_menu () {
$items['menuitem'] = array (
'title' => 'Menu title',
'page callback' => 'MYMODULE_page',
'page arguments' => array(1),
'access arguments' => array ('view this page'),
'menu_name' => 'menu'
);
return $items;
}
function MYMODULE_permission () {
return array (
'view this page' => array ('title' => t('View this page')),
);
}
function MYMODULE_theme () {
return array(
'MYMODULE_form' => array (
'arguments' => array ('form' => NULL),
'render element' => 'form'
),
);
}
function MYMODULE_page ($date = false) {
$date = (!$date) ? date ("Y-m-d") : $date;
$form = drupal_get_form ('MYMODULE_form', $date);
$form = drupal_render ($form);
return $form;
}
function MYMODULE_form ($form, &$form_state, $date) {
$form = array();
// more form stuff
// how to pass $date to MYMODULE_form theme function?
$form['#theme'] = 'MYMODULE_form';
return $form;
}
function theme_MYMODULE_form (&$variables) {
$output = '';
$form = &$variables['form'];
// A lot of form theme stuff
$output .= drupal_render_children ($form);
}
Hi everyone,
I am having a bit of trouble and was hoping someone might be able to help me. I have been working locally with Wampserver developing a website for a client. I am now trying to export the website to a server so I can make sure when I have to migrate it to the clients server I can do it without any problems.
Hi
I'm using jQuery to find a class on a page, but I am running into a strange problem with Drupal 7.
When I use Firebug console to run the following simple test:
if ($('div').hasClass('content')) {
console.log('yes');
};
On Drupal 6 sites, this works all the time, but in +90% of Drupal 7 sites (I tested quite a few) I get
TypeError: $("div") is null
I need to create a simple module where I can add a item, I just need to specify a Item name, Description
then be able to upload an image how can I do this ?
I am looking to use Flash in Drupal but haven't had any luck with the CKEditor SWF plugin.
Has anyone successfully used this module for Flash content in Drupal 7? Are there any
others that work well?