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
Comment #2
nicoloye commentedComment #3
si.mon commentedComment #4
si.mon commentedWorks like a charm, going RTBC.
Comment #5
fizk commentedDo other Drupal modules generally provide alter hooks in theme functions? Should we be adding alter hooks in all theme functions?
Comment #6
nicoloye commentedI'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.
Comment #8
fizk commentedCommitted, thanks.
Comment #9
renrhafHello fizk and thanks for merging this.
Could this be possible to have a tagged release with this ?
Comment #10
fizk commentedRenrhaf, sure, I'll release 7.x-2.1 within the next 30 days.
Comment #11
renrhafGreat ! :)
And BTW, shouldn't this hook be documented somewhere in a nodequeue.api file or something ?
I can provide the patch if needed !
Comment #12
fizk commentedSounds good. If you can create a patch, I'll commit.