diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-07-01 21:52:43 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-07-01 21:52:43 +0000 |
commit | ef29077044df8735be7fdaeed7c32181eee0ed29 (patch) | |
tree | 655f64994c7527a6f81387e015a228a34714384c /modules | |
parent | a1a556b8c1904e624650059e7091f6864119cf65 (diff) | |
download | brdo-ef29077044df8735be7fdaeed7c32181eee0ed29.tar.gz brdo-ef29077044df8735be7fdaeed7c32181eee0ed29.tar.bz2 |
#108456 by RobRoy: optional custom teaser lengths and much needed documentation on how node_teaser works
Diffstat (limited to 'modules')
-rw-r--r-- | modules/node/node.module | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/modules/node/node.module b/modules/node/node.module index 5c329ed2d..c1eadf292 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -204,10 +204,23 @@ function node_teaser_js(&$form, &$form_state) { /** * Automatically generate a teaser for a node body in a given format. + * + * @param $body + * The content for which a teaser will be generated. + * @param $format + * The format of the content. If the content contains PHP code, we do not + * split it up to prevent parse errors. + * @param $size + * The desired character length of the teaser. If omitted, the default + * value will be used. + * @return + * The generated teaser. */ -function node_teaser($body, $format = NULL) { +function node_teaser($body, $format = NULL, $size = NULL) { - $size = variable_get('teaser_length', 600); + if (!isset($size)) { + $size = variable_get('teaser_length', 600); + } // Find where the delimiter is in the body $delimiter = strpos($body, '<!--break-->'); |