Hello,

the way the subqueue arrange form is displayed does not provide any easy way to alter its output. Basically if you need to add a column in this form array you need to totally override the default "nodequeue_arrange_subqueue_form_table" theme function, which is sad.

In my use case I wanted to add some informations linked to the node like its language and I had to rewrite the full theme function for changing just 3 lines of code. So I suggest adding this little alteration entry to allow other modules adding their specific needs easily. For example in my case I only had to add a few lines to handle the thing:

function [MY_MODULE]_nodequeue_arrange_subqueue_form_alter(&$form, &$header, &$rows) {
  // Insert the language column.
  array_splice($header, 1, 0, t('Language'));

  $current_row = 0;
  $languages = locale_language_list('name');
  foreach (element_children($form) as $key) {
    array_splice($rows[$current_row]['data'], 1, 0, t($languages[$form[$key]['#node']['language']]));
    $current_row++;
  }
}

Maybe this can be implemented differently but here is a first suggestion :)

Comments

nicoloye created an issue. See original summary.

nicoloye’s picture

si.mon’s picture

Issue summary: View changes
si.mon’s picture

Status: Active » Reviewed & tested by the community

Works like a charm, going RTBC.

fizk’s picture

Do other Drupal modules generally provide alter hooks in theme functions? Should we be adding alter hooks in all theme functions?

nicoloye’s picture

I'm not sure what is the best practice.
Generally theme functions use preprocess functions to allow modifications ... but here a preprocess may not be very effective as the only usable preprocess is the one on theme_table which doesn't give us very precise variables (for example you don't have any direct access to any of the nodes to grab informations from.
I don't see many other ways to achieve this type of modifications.

  • fizk committed ceff5f4 on 7.x-2.x authored by nicoloye
    Issue #2599220 by nicoloye: Allow better control on the nodequeue table...
fizk’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks.

renrhaf’s picture

Hello fizk and thanks for merging this.
Could this be possible to have a tagged release with this ?

fizk’s picture

Renrhaf, sure, I'll release 7.x-2.1 within the next 30 days.

renrhaf’s picture

Great ! :)

And BTW, shouldn't this hook be documented somewhere in a nodequeue.api file or something ?
I can provide the patch if needed !

fizk’s picture

Sounds good. If you can create a patch, I'll commit.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.