Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7836787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:18:47+00:00 2026-06-02T14:18:47+00:00

Drupal doesn’t call my theme function for my form in my module. I added

  • 0

Drupal doesn’t call my theme function for my form in my module.

I added the hook_theme in the .module file as this :

function agil_theme() {
    return array(
        'agil_list_form' => array(
            'render element' => 'form',
        ),
    );
}

where :

  • agil is the name of my module (not my theme)
  • agil_list_form is the name of my form declaration (chich render with default theme)

I want to call a function to create my own markup, as this one :

function theme_agil_list_form($form) {
  $output  = "<table><th><td></td><td>".t('Title')."</td><td>".t('Link')."</td></th>";
    $output .= "<tr><td>";
  $output .= drupal_render($form['name']);
  ...

But Drupal is never calling this function… I cleared the cache but nothing..

Where do I miss something ?

I read also this about new theme declaration in Drupal 7 :
http://drupal.org/update/modules/6/7#hook_theme_render_changes

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T14:18:49+00:00Added an answer on June 2, 2026 at 2:18 pm

    All theme functions in Drupal 7 take a single array argument (usually named as $vars or $variables by convention), and that array contains the variables/render elements you’ve declared. The theme function itself would look like this:

    function theme_agil_list_form($vars) {
      $form = $vars['form'];
      // Now manipulate $form
    }
    

    Also you need to tell Drupal that your form will be using this theme, by doing this in your form function:

    $form['#theme'] = 'agil_list_form';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Drupal 6.x I have this module that manages four different content types. For that
For some reason the ImageCache module doesn't work. Drupal just doesn't generate the ImageCache
I have troubles with Drupal 7 and file uploading. My code that doesn't work:
the default login form in drupal doesn't have any javascript to check whether the
I'm creating a Drupal module which doesn't necessarily depend on other modules, but could
I have a Drupal module page where I am populating a form with a
I'm developing a custom module for Drupal 6, that creates a simple form. My
I have a simple Drupal form in a custom module where exiting a textfield
It's similar to what Drupal has . My current function definition is like this:
I want in my template.php (drupal theme) something like this: $search_button ='search-button.png'; if($('#page-wrapper').hasClass('blue-colour')) {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.