Created
July 9, 2016 15:52
-
-
Save aklump/9d85a591f73c5f5015c63f3cc429c0d9 to your computer and use it in GitHub Desktop.
remove drupal tabledrag in your theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Implements hook_preprocess_HOOK(). | |
| */ | |
| function THEMENAME_preprocess_field_multiple_value_form(&$vars) { | |
| if (isset($vars['table']['#tabledrag'])) { | |
| unset($vars['table']['#tabledrag']); | |
| array_pop($vars['table']['#header']); | |
| foreach ($vars['table']['#rows'] as &$row) { | |
| foreach (array_keys($row['data']) as $key) { | |
| if (array_intersect($row['data'][$key]['class'], [ | |
| 'field-multiple-drag', | |
| 'delta-order', | |
| ])) { | |
| unset($row['data'][$key]); | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello, thanks for this example
I use this example in D8, but I get the following error message in the log file. Do you have an idea why?
Warning: array_intersect(): Argument #1 is not an array in xxxx_preprocess_field_multiple_value_form(Line 29)
Line 29 = if (array_intersect($row['data'][$key]['class'], [
'field-multiple-drag',
'delta-order',
])) {