Commit d748fcb7 authored by KarenS's avatar KarenS

#198420 Make sure internal field and widget names are truncated to 32...

#198420  Make sure internal field and widget names are truncated to 32 characters to match the database values.
parent 010dc7af
......@@ -6,6 +6,9 @@
Bugfix
------
General
- #198420 Make sure internal field and widget names are truncated to 32 characters to match the database values.
Field / widget modules
- #140687 OptionWidgets : fix 'single checkbox' stick on checked when used with text values.
......
......@@ -777,28 +777,36 @@ function _content_type_info($reset = FALSE) {
$module_field_types = module_invoke($module, 'field_info');
if ($module_field_types) {
foreach ($module_field_types as $name => $field_info) {
$info['field types'][$name] = $field_info;
$info['field types'][$name]['module'] = $module;
$info['field types'][$name]['formatters'] = array();
// Truncate names to match the value that is stored in the database.
$db_name = substr($name, 0, 32);
$info['field types'][$db_name] = $field_info;
$info['field types'][$db_name]['module'] = $module;
$info['field types'][$db_name]['formatters'] = array();
}
}
$module_widgets = module_invoke($module, 'widget_info');
if ($module_widgets) {
foreach ($module_widgets as $name => $widget_info) {
$info['widget types'][$name] = $widget_info;
$info['widget types'][$name]['module'] = $module;
// Truncate names to match the value that is stored in the database.
$db_name = substr($name, 0, 32);
$info['widget types'][$db_name] = $widget_info;
$info['widget types'][$db_name]['module'] = $module;
foreach ($widget_info['field types'] as $delta => $type) {
$info['widget types'][$db_name][$delta] = substr($type, 0, 32);
}
}
}
}
foreach (module_list() as $module) {
$module_formatters = module_invoke($module, 'field_formatter_info');
if ($module_formatters) {
foreach ($module_formatters as $name => $formatter_info) {
foreach ($formatter_info['field types'] as $field_type) {
$info['field types'][$field_type]['formatters'][$name] = $formatter_info;
$info['field types'][$field_type]['formatters'][$name]['module'] = $module;
// Truncate names to match the value that is stored in the database.
$db_name = substr($field_type, 0, 32);
$info['field types'][$db_name]['formatters'][$name] = $formatter_info;
$info['field types'][$db_name]['formatters'][$name]['module'] = $module;
}
}
}
......
......@@ -27,6 +27,9 @@
* An array keyed by field type name. Each element of the array is an associative
* array with these keys and values:
* - "label": The human-readable label for the field type.
*
* IMPORTANT! - field and widget names will be truncated to 32 characters in
* the database and in internal arrays, like content_fields().
*/
function hook_field_info() {
return array(
......@@ -307,6 +310,9 @@ function hook_field_formatter($field, $item, $formatter, $node) {
* - "label": The human-readable label for the widget.
* - "field types": An array of field type names that can be edited using
* this widget.
*
* IMPORTANT! - field and widget names will be truncated to 32 characters in
* the database and in internal arrays, like content_fields().
*/
function hook_widget_info() {
return array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment