Last active
February 17, 2017 06:04
-
-
Save lhuria94/03303322914ce549094d693eefb12011 to your computer and use it in GitHub Desktop.
Remove image object markup from rendering in Drupal 7 (Helpful for teaser display)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$body_text_alter_params = array( | |
'max_length' => 300, | |
'ellipsis' => FALSE, | |
'word_boundary' => TRUE, | |
'html' => FALSE, | |
); | |
// Removes unnecessary markup. | |
$trimmed_body = check_plain(strip_tags($value->body_value, '<p>')); | |
// Trimming the body text as per the parameters defined in | |
// {$body_text_alter_params}. | |
$trimmed_body = views_trim_text($body_text_alter_params, drupal_html_to_text(check_markup($trimmed_body, $value->body_format))); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment