Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
API page: https://api.drupal.org/api/drupal/core!includes!common.inc/function/drup...
Examples in documentation:
drupal_attach_tabledrag('my-module-table', array( ... )
Should be:
drupal_attach_tabledrag($table, array( ... )
and options should include 'table_id' key
Steps to reproduce
Proposed resolution
Give examples of how to set up the form array. And we should definitely not have a call to drupal_render() in there!!
Remaining tasks
Patch
review
commit
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#6 | attach-tabledrag-doc-2542780-6.patch | 910 bytes | Pravin Ajaaz |
Comments
Comment #1
jhodgdonThanks for reporting this!
We don't actually want random tags on issues -- please read the tag guidelines (link below the tag field).
Anyway, seems like a good thing to fix.
Comment #2
Pravin Ajaaz CreditAttribution: Pravin Ajaaz commentedHere is a patch which fixes it.
Comment #3
Pravin Ajaaz CreditAttribution: Pravin Ajaaz commentedComment #4
jhodgdonHm. OK, that seems like a good change to make. We should have a follow-up issue to fix the documentation up further though. There are all kinds of problems in it, like:
- It doesn't tell you that it can be called automatically if you set up your render array right.
- It shows a call to drupal_render() that we would never actually want to do.
Comment #5
alexpottIt's not $table it's $element.
Comment #6
Pravin Ajaaz CreditAttribution: Pravin Ajaaz commented@alexpott: Yes it is. Thanks for pointing.
Comment #7
Pravin Ajaaz CreditAttribution: Pravin Ajaaz commentedComment #8
jhodgdonHm, I don't think that is quite right either.
Really, all of the code on
https://api.drupal.org/api/drupal/core!includes!common.inc/function/drup...
is a mess.
And you wouldn't really call drupal_attach_tabledrag() directly anyway.
So I think this whole doc block should be rewritten and we can't just fix it by this two-line patch. It needs a complete rewrite. I don't think we should give examples of how to call this function, we should just give examples of how to set up the form array. And we should definitely not have a call to drupal_render() in there!!
Comment #20
quietone CreditAttribution: quietone at PreviousNext commentedI used gitblame to determine that the documenation has not been changed. I am not sure what 'mess' means here so I am not sure if this is really a bug or not. There hasn't been any activity here for 7 years which suggests that the documentation is not hindering usage of tabledrag so I am moving this to a task.