theme_datatable() assumes that all the items in the $header array have datatable options:
// or in each header definition.
if (!isset($datatable_options['aoColumns'])) {
foreach ($header as $key => $cell) {
$datatable_options['aoColumns'][] = $cell['datatable_options'];
unset($header[$key]['datatable_options']);
}
}
This causes a fatal if they are not:
( ! ) Fatal error: Cannot unset string offsets in sites/all/modules/contrib/datatables/datatables.module on line 166
Note that the docs say that this should work fine:
* @param $header
* An array containing the table headers. Each element of the array can be
* either a localized string or an associative array with the following keys:
* - "data": The localized title of the table column.
* - Any HTML attributes, such as "colspan", to apply to the column header
* cell.
* - "datatable_options": An associative array containing DataTable column
* specific features/options.
Comment | File | Size | Author |
---|---|---|---|
#4 | 1904140-datatables-fix-errors-when-headers-are-strings.patch | 549 bytes | Dave Reid |
Comments
Comment #1
duellj CreditAttribution: duellj commentedThanks @joachim, fixed in dev branch.
Comment #3
Dave ReidVery sorry to re-open this, but I still believe this is not correct, because the errors are caused by the unset() call itself because $headers[$key] is a string, and not an array.
Comment #4
Dave ReidHere is the real fix.
Comment #5
duellj CreditAttribution: duellj commentedThanks Dave. Commmitted to 7.x-1.x-dev branch