I use the following code to override all sorts of Drupal forms in template.php

function THEME_theme() {
  $items = array();
    
  $items['user_login'] = array(
    'render element' => 'form',
    'template' => 'user-login',
    'preprocess functions' => array('THEME_preprocess_user_login'),
  );

  return $items;
}

In this case I use user-login.tpl.php to handle the user login form.

Now I tried to override the Commerce Product Form using commerce-product-ui-product-form.tpl.php and this code in template.php:

function THEME_theme() {
  $items = array();
    
  $items['commerce_product_ui_product_form'] = array(
    'render element' => 'form',
    'template' => 'commerce-product-ui-product-form',
    'preprocess functions' => array(
      'THEME_preprocess_commerce_product_ui_product_form'
    ),
  );

  return $items;
}

But this doesn't seems to work for the Commerce Product Form. Is there a way to override the Commerce Product Form?

Comments

rszrama’s picture

Status: Active » Closed (fixed)

I'd just try doing it with commerce_product_product_form instead. The UI form ID is just a wrapper of that form, so perhaps the theme system is using the base callback.