diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-08-08 13:02:37 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-08-08 13:02:37 +0000 |
commit | f0b3fa4b1bb0b8c91424c3ad36dfef592ccbc954 (patch) | |
tree | 84679f95714d6b04ee10442ffc255c4b5bd1b4d2 /modules/node/node.install | |
parent | f885d9f7dca9242b7906d6d441cae5feb2aba5b1 (diff) | |
download | brdo-f0b3fa4b1bb0b8c91424c3ad36dfef592ccbc954.tar.gz brdo-f0b3fa4b1bb0b8c91424c3ad36dfef592ccbc954.tar.bz2 |
- Patch #504564 by tic2000, andypost, catch: the 'Length of trimmed content'
form input in the 'node type' edit form was way too harsh (affects the
display of all 'trimmed / summary_or_trimmed' formatters on all text
fields in all view modes), and irrelevant for text fields on non-node
entities, which are currently all blocked to 'trim to 600 chars'.
* Added field formatter settings for 'text_trimmed' and 'text_summary_or_trimmed' formatters
* Removed 'teaser_length' settings for node types
* Added upgrade path for 'teaser_length' variable in node_update_7011()
* Fixed a test
Diffstat (limited to 'modules/node/node.install')
-rw-r--r-- | modules/node/node.install | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/modules/node/node.install b/modules/node/node.install index b5e10d6b0..cc3d8ee97 100644 --- a/modules/node/node.install +++ b/modules/node/node.install @@ -496,11 +496,29 @@ function node_update_7006(&$sandbox) { ->fields('node_type') ->execute(); + $default_trim_length = variable_get('teaser_length', 600); // Add body field instances for existing node types. foreach ($result as $node_type) { if ($node_type->has_body) { - node_add_body_field($node_type, $node_type->body_label); + $instance = node_add_body_field($node_type, $node_type->body_label); + // Update newly created instance to convert teaser_length variable + // into formatter settings. + $trim_length = variable_get('teaser_length_' . $node_type->type, $default_trim_length); + $instance_changed = FALSE; + foreach ($instance['display'] as $view_mode => $view_mode_info) { + if ($view_mode_info['type'] == 'text_trimmed' || $view_mode_info['type'] == 'text_summary_or_trimmed') { + if (!isset($view_mode_info['settings']['trim_length'])) { + $instance['display'][$view_mode]['settings']['trim_length'] = $trim_length; + $instance_changed = TRUE; + } + } + } + if ($instance_changed) { + field_update_instance($instance); + } + variable_del('teaser_length_' . $node_type->type); } + // Leave 'teaser_length' variable for aggregator module upgrade. $sandbox['node_types_info'][$node_type->type] = array( 'has_body' => $node_type->has_body, |