Skip to content

Instantly share code, notes, and snippets.

@aklump
Created July 9, 2016 15:52
Show Gist options
  • Select an option

  • Save aklump/9d85a591f73c5f5015c63f3cc429c0d9 to your computer and use it in GitHub Desktop.

Select an option

Save aklump/9d85a591f73c5f5015c63f3cc429c0d9 to your computer and use it in GitHub Desktop.
remove drupal tabledrag in your theme
/**
* 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]);
}
}
}
}
}
@CarstenHager
Copy link

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',
])) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment