0

我正在尝试将主题与一些复选框的样式挂钩。我已经使用 form_alter 挂钩对每个复选框的标签进行了一些更改,现在我想与复选框主题功能进行交互以设置标签的样式。

在表单数组中它说

#theme (String, 20 characters ) select_as_checkboxes

这是我需要覆盖的功能吗?我该怎么做?我试过像

function mymodule_select_as_checkboxes()

但我无法让它工作

4

1 回答 1

0

解决方案:

   function my_module_theme_registry_alter(&$theme_registry) {
      // Register theme_function to use the module custom function
      if (!empty($theme_registry['select_as_checkboxes'])) {
        $theme_registry['select_as_checkboxes']['function'] = 'my_module_select_as_checkboxes';
      }
    }

然后在 my_module_select_as_checkboxes 函数中创建自己的函数或改编原始函数。

于 2011-08-19T09:46:07.680 回答