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.
I am trying to find a way, if there is one, to prevent a user from rebuilding the table when they are creating content. I have a table that is X columns by Y rows and it doesn't need to be changed for the content type I've created. I'd like to remove the "How many Columns:" and "How many rows:" fields, and remove the "Rebuild Table" button, or at least disable them.
Comment | File | Size | Author |
---|---|---|---|
#15 | tablefield-7.x-2.1.patch | 1.16 KB | h.arefmanesh |
#7 | tablefield_tablecontrol_764788.patch | 6.86 KB | jonathan_hunt |
#6 | tablecontrol.patch | 3 KB | giorgio79 |
#5 | tablecontrol.patch | 2.95 KB | giorgio79 |
#3 | tablecontrol.patch | 2.59 KB | giorgio79 |
Comments
Comment #1
Kevin Hankens CreditAttribution: Kevin Hankens commentedYeah, that's a great idea. What we should do is add a hook_perm entry and use user_access() when it builds the form. Feel free to submit a patch. Otherwise, I can probably do one later this afternoon...
Comment #2
giorgio79 CreditAttribution: giorgio79 commented+1
Comment #3
giorgio79 CreditAttribution: giorgio79 commentedHello,
Here is a patch.
It adds two checkboxes on the edit field page:
1. Enable Users changing the number of rows
2. Enable Users changing the number of columns
Default is enabled.
If both are disabled no buttons show, if one of them is enabled the field plus the rebuild button shows.
Check it out :)
Comment #4
giorgio79 CreditAttribution: giorgio79 commentedComment #5
giorgio79 CreditAttribution: giorgio79 commentedFound a bug, here is a new version
Comment #6
giorgio79 CreditAttribution: giorgio79 commentedEven more improvements. Now the default table rebuild options appear regardless of these switches.
Comment #7
jonathan_hunt CreditAttribution: jonathan_hunt commentedThis patch improves on #6 by making the CSV upload an option on a per-field instance (and improves code style also).
Comment #8
bojanz CreditAttribution: bojanz commentedI agree with #7, it's better to have it as a per-field setting (my use case requires the rebuild option to be gone for all roles).
I think the option between "have it"/"don't have it" is much common than "let this role have it"/"but don't let those two have it".
Plus, if it's this way then I can turn off rebuilding when creating a field. If it's a permission then I can't do anything from code.
Checked, still applies against the D6 version.
Marking as RTBC.
If you agree, I can provide the reroll for 7.x.
Comment #9
tectokronos CreditAttribution: tectokronos commentedHi,
There is a little error in the patch posted by jonathan_hunt:
Double periods (wrong):
Correction:
This patch is awesome. Thank you very much!! :D
Comment #10
qayoub CreditAttribution: qayoub commentedHelp!!
how can i fix the header of a table field for a specific content type !?
Comment #11
bassem CreditAttribution: bassem commentedHello all,
ANy news for the same feature being available for D7? it is quite essential if you are using cck forms for online applications that handle quite a large number of submissions and allowing csv uploads could be a high security risk.
regards,
bas
Comment #12
jaskegreen CreditAttribution: jaskegreen commentedStill need this to work in version 7.
Cheers,
Jason
Comment #13
sam@sasiaccc.org CreditAttribution: sam@sasiaccc.org commentedHi ,
I am very new to drupal. Can some say how to install the patch so that I could disable the "rebuild table" option
Thanks in advance
Comment #14
drifter CreditAttribution: drifter commentedHere's a form_alter hook that will disable the rebuild table and import options on Drupal 7. You can use them in a custom module. The important thing is that count_cols and count_rows still need to be passed.
Comment #15
h.arefmanesh CreditAttribution: h.arefmanesh commentedI write a new patch ,
This patch create a permission for displaying "rebuild table" button.
Comment #16
Kevin Hankens CreditAttribution: Kevin Hankens commentedSo sorry that this has languished for so long. I'm trying desperately to play catch up here.
Here's a commit to 7.x-2.x that provides role-based access permissions to rebuild the tables. There's an edge case where csv imports can redefine the structure, but it's probably debatable as to how to handle that.
Thanks to everyone who contributed!!
http://drupalcode.org/project/tablefield.git/commit/6cbec457d80100b578c1...