1

My problem seems to be related with my theme function not being called.

$items['user/%/car/form'] = array(
        'title' => 'Car',
        'description' => 'Cars',
        'file' => 'car/cars.inc',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('car_form'),
        'access arguments' => array('car form'),
        'type' => MENU_LOCAL_TASK,
);

With this link to the same form, everything works correctly, theme function gets called.

$items['cars/car/form'] = array(
        'title' => 'Car',
        'description' => 'Cars',
        'file' => 'car/cars.inc',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('car_form'),
        'access arguments' => array('car form'),
    );

In the form array

$form['#theme'] = 'cars';

In the modules theme function

'cars' => array
        (
            'render element' => 'form'
        ),

Anyone knows how to print forms? I can print tables into user profile tabs, but with forms I just get an empty page.

  • Did you clear the cache? after clearing the cache check the theme registry provided by devel module to see if the theme name of the form is in there. If it is not, switch your theme to admin theme then check again. – M a m a D May 3 '15 at 16:25
  • I cleared the cache in every modification made to hook_menu(). Also changed to admin theme but problem continues. Devel output: #theme (String, 4 characters ) page $...['#theme'] #theme_wrappers (Array, 1 element) 0 (String, 4 characters ) html – Claudio May 3 '15 at 17:28
  • Was the the form theme name in the theme registry? – M a m a D May 3 '15 at 17:29
  • Yes, the theme name is in the registry. 9: _theme_build_registry() (Array, 2 elements) file (String, 22 characters ) includes\theme.inc:698 args (Array, 3 elements) 0 (String, 18 characters ) bootstrap_business 1 (NULL) 2 (NULL) – Claudio May 3 '15 at 17:44
  • It seems that the theme function of module is being overridden by the template function. Is it possible to make template theme call my theme implementations that is in the module? – Claudio May 3 '15 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.