summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEarl Miles2009-04-08 03:51:17 (GMT)
committer Earl Miles2009-04-08 03:51:17 (GMT)
commita1a36a140b6737fedfeb24098d7478457caf4ed9 (patch)
tree755e08f54e37b954fd5a78928ccaa3ae1e9b4f21
parent5cb0a30ec6f6577078a91389fcf1a5064a40fa3b (diff)
#379382 by neochief: Add option to strip tags during advanced rendering.
-rw-r--r--CHANGELOG.txt3
-rw-r--r--handlers/views_handler_field.inc20
2 files changed, 23 insertions, 0 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 6a63083..b09b701 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,4 +1,7 @@
CHANGELOG for Views 2 for Drupal 6
+Views 2.5
+ Other changes:
+ o #379382 by neochief: Add option to strip tags during advanced rendering.
Views 2.4
Bugs fixed:
o #371466 by dereine: Fix incorrect link to comments.
diff --git a/handlers/views_handler_field.inc b/handlers/views_handler_field.inc
index a51fb2d..5d97718 100644
--- a/handlers/views_handler_field.inc
+++ b/handlers/views_handler_field.inc
@@ -155,6 +155,7 @@ class views_handler_field extends views_handler {
'max_length' => array('default' => ''),
'word_boundary' => array('default' => TRUE),
'ellipsis' => array('default' => TRUE),
+ 'strip_tags' => array('default' => FALSE),
'html' => array('default' => FALSE),
),
);
@@ -332,6 +333,17 @@ class views_handler_field extends views_handler {
),
);
+ $form['alter']['strip_tags'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Strip HTML tags'),
+ '#description' => t('If checked, all HTML tags will be stripped.'),
+ '#default_value' => $this->options['alter']['strip_tags'],
+ '#process' => array('views_process_dependency'),
+ '#dependency' => array(
+ 'edit-options-alter-trim' => array(1)
+ ),
+ );
+
$form['alter']['html'] = array(
'#type' => 'checkbox',
'#title' => t('Field can contain HTML'),
@@ -425,6 +437,14 @@ class views_handler_field extends views_handler {
* Trim the field down to the specified length.
*/
function render_trim_text($value) {
+ if (!empty($this->options['alter']['strip_tags'])) {
+ $value = strip_tags($value);
+ // NOTE: It's possible that some external fields might override the
+ // element type so if someone from, say, CCK runs into a bug here,
+ // this may be why =)
+ $this->definition['element type'] = 'span';
+ }
+
if (drupal_strlen($value) <= $this->options['alter']['max_length']) {
return $value;
}