1

I'm building a module to extend the functionality of Nodequeue. So in the nodequeue list I wanna add one more operation link (to the current View | Edit | Delete operations).

The list is build up in a table using theme('table') by Nodequeue.

So for me the be able to extend the content of this table and add one more link, I'm thinking I'll have to preprocess the table theme? So I'll make a MYMODULE_preprocess_table(&$variables)?

But I just feels like its totally overkill? It must be more simple than that? Like in the Form API hooks, I have hook_form_FORM_ID_alter().

Is there any alternative to hook_preprocess_hook?

3

Unlike forms, specific invocations of theme functions don't have identifiers associated with them, so there's no mechanism like hook_form_FORM_ID_alter() that you can use unfortunately.

I can only find one call to theme('table') in the nodequeue module so I think you're talking about the theme_nodequeue_arrange_subqueue_form_table() function.

Luckily enough, this function assigns a unique id to each table (which believe me isn't always the case), so at least you can target it in a preprocess function:

function MYMODULE_preprocess_table(&$variables) {
  if (isset($variables['attributes']['id']) && $variables['attributes']['id'] == 'the_id') {
    // Alter the table
  }
}

As the theme_nodequeue_arrange_subqueue_form_table() function actually renders the table to a string (it has to, being that it's a theme function itself), I don't think there's any other way to do this.

The other (more long-winded way) would be to implement your own version of the entire theme_nodequeue_arrange_subqueue_form_table() function, copying the code from the original and just changing what you need to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.