Browse Source

removed depracted function call

master
ppound 6 months ago
parent
commit
1716f0f878
  1. 6
      magazineplus.theme

6
magazineplus.theme

@ -830,7 +830,7 @@ function magazineplus_preprocess_node(&$variables) {
->getCreatedTime(), $granularity = 1);
$node_content = $variables['content'];
$node_content = render($node_content);
$node_content = \Drupal::service('renderer')->render($node_content);
$words = str_word_count(strip_tags($node_content));
$minutes = floor($words / 275);
$variables['minutes'] = $minutes;
@ -859,11 +859,11 @@ function magazineplus_preprocess_node__article(&$variables) {
// Count the words of article in order to calculate the reading time
$node_content = $variables['content'];
$node_content = render($node_content);
$node_content = \Drupal::service('renderer')->render($node_content);
$words = str_word_count(strip_tags($node_content));
if (isset($variables['content']['comment'])) {
$node_comments = $variables['content']['comment'];
$node_comments = render($node_comments);
$node_comments = \Drupal::service('renderer')->render($node_comments);
$words = $words - str_word_count(strip_tags($node_comments));
}
$variables['minutes'] = floor($words / 275);

Loading…
Cancel
Save