To create empty cell, you may use syntax like "1|2|3||4"
add to cck_table.module:
<?php
/**
* Implementation of hook_field().
*/
function cck_table_field($op, &$node, $field, &$items, $teaser, $page) {
switch ($op) {
case 'validate':
$allowed_values = content_allowed_values($field);
if (is_array($items)) {
foreach ($items as $delta => $item) {
$error_element = isset($item['_error_element']) ? $item['_error_element'] : '';
if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']);
if ($item['value'] != '') {
$lines = explode("\n", $item['value']);
$lines = array_map('trim', $lines);
$lines = array_filter($lines, 'strlen');
$cell_count;
foreach ($lines as $line) {
if(!$cell_count) {
$cell_count = count(explode('|', $line));
} elseif($cell_count != count(explode('|', $line))) {
form_set_error($error_element, t('%name: mis-align number of columns.', array('%name' => t($field['widget']['label']))));
break;
}
}
}
}
}
return $items;
}
}
?>
Comments
Comment #1
joetsuihk commentedissue messing up in previous patch file, this one fixed.
Comment #2
istryker commentedDo you think that this is something that should be enforce, or be optional?
Comment #3
istryker commentedI have added an optional checkbox to the field form. By default it is enabled.
http://drupal.org/files/1013224-misalign-col_0.png">
Comment #4
istryker commentedCommited to D6 & D7 branch