Drupal:如何从contrib模块重写函数

Drupal:如何从contrib模块重写函数,drupal,drupal-modules,drupal-commerce,Drupal,Drupal Modules,Drupal Commerce,我正在使用一个模块为Drupal商务项目构建价格表。有一个函数用于格式化表格标题: /** * Helper function that takes care of the quantity displayed in the headers of * the price table. */ function commerce_price_table_display_quantity_headers($item) { // Set the quantity text to unlimi

我正在使用一个模块为Drupal商务项目构建价格表。有一个函数用于格式化表格标题:

/**
 * Helper function that takes care of the quantity displayed in the headers of 
 * the price table.
 */
function commerce_price_table_display_quantity_headers($item) {
  // Set the quantity text to unlimited if it's -1.
  $max_qty = $item['max_qty'] == -1 ? t('Unlimited') : $item['max_qty'];
  // If max and min qtys are the same, only show one.
  if ($item['min_qty'] == $max_qty) {
    $quantity_text = $item['min_qty'];
  }
  else {
    $quantity_text = $item['min_qty'] . ' - ' . $max_qty;
  }
  return $quantity_text;
}
如您所见,这不是一个主题函数,我可以在template.php中重写它,但我可以调整一些输出

如何重新定义此函数,以便对一些内容进行删减和更改?

我的工作到目前为止

到目前为止,我已经尝试将它创建为一个单独的模块,并进行了一些细微的更改,以显示它是否工作,但它没有覆盖任何输出

信息文件

; $id$
name = Price Table: Tweaked Display
description = A different layout for the price table as shown on the product display nodes
package = Commerce (contrib)
core = 7.x

dependencies[] = commerce_product
dependencies[] = commerce_price
dependencies[] = commerce_price_table
模块文件

; $id$
name = Price Table: Tweaked Display
description = A different layout for the price table as shown on the product display nodes
package = Commerce (contrib)
core = 7.x

dependencies[] = commerce_product
dependencies[] = commerce_price
dependencies[] = commerce_price_table

我相信大多数drupal模块都有一个hook_函数(或者至少是一个可挂接的函数),我不怎么做,所以我会在drupal api中搜索如何挂接函数以及您的模块是否支持它

嗨,谢谢你的意见。我问了一下,得到了一个相当不错的回答