Skip to main content
improved grammar
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

D7 : How to override node comment form template?

I usually override a form template use thethis way:

In a .moudle file :

/**
 * Implementation of hook_theme().
 */
function MODUL_NAME_themeMODULE_theme() {
  return array(
    'user_login' => array(
      'render element' => 'form',
      'template' => 'user_login',
      'path' => drupal_get_path('module', 'MODUL_NAME''MODULE').'/templates',
    ),
  );
}

And thenI create templates/user_login.tpl.php in my module folder.

Thenfolder; then, I can override the form.

But today I try to overridetried overriding a node comment form usenode comment form this way, but it doesn'tdidn't work.

: The node comment formnode comment form didn't use my custom template file.

I have goolgegoogled a lot, but getI got nothing about override node comment form templateoverriding a node comment form template.

Does anyone have good idea How can I force Drupal to use a template file for the node comment form?

D7 : How to override node comment form template?

I usually override a form template use the way:

In a .moudle file :

/**
 * Implementation of hook_theme().
 */
function MODUL_NAME_theme() {
  return array(
    'user_login' => array(
      'render element' => 'form',
      'template' => 'user_login',
      'path' => drupal_get_path('module', 'MODUL_NAME').'/templates',
    ),
  );
}

And then create templates/user_login.tpl.php in my module folder.

Then I can override the form.

But today I try to override a node comment form use this way, it doesn't work.

The node comment form didn't use my custom template file.

I have goolge a lot, but get nothing about override node comment form template.

Does anyone have good idea ?

How to override node comment form template?

I usually override a form template this way.

/**
 * Implementation of hook_theme().
 */
function MODULE_theme() {
  return array(
    'user_login' => array(
      'render element' => 'form',
      'template' => 'user_login',
      'path' => drupal_get_path('module', 'MODULE').'/templates',
    ),
  );
}

I create templates/user_login.tpl.php in my module folder; then, I can override the form.

I tried overriding a node comment form this way, but it didn't work: The node comment form didn't use my custom template file.

I have googled a lot, but I got nothing about overriding a node comment form template.

How can I force Drupal to use a template file for the node comment form?

Source Link
Rylyn
  • 400
  • 4
  • 14

D7 : How to override node comment form template?

I usually override a form template use the way:

In a .moudle file :

/**
 * Implementation of hook_theme().
 */
function MODUL_NAME_theme() {
  return array(
    'user_login' => array(
      'render element' => 'form',
      'template' => 'user_login',
      'path' => drupal_get_path('module', 'MODUL_NAME').'/templates',
    ),
  );
}

And then create templates/user_login.tpl.php in my module folder.

Then I can override the form.

But today I try to override a node comment form use this way, it doesn't work.

The node comment form didn't use my custom template file.

I have goolge a lot, but get nothing about override node comment form template.

Does anyone have good idea ?