You are here

function thunder_fia_preprocess_paragraph in Thunder 8.2

Same name and namespace in other branches
  1. 8.3 modules/thunder_article/modules/thunder_fia/thunder_fia.module \thunder_fia_preprocess_paragraph()

Implements hook_preprocess_paragraph().

File

modules/thunder_article/modules/thunder_fia/thunder_fia.module, line 115
Thunder Article module hooks.

Code

function thunder_fia_preprocess_paragraph(&$variables) {

  /** @var \Drupal\paragraphs\Entity\Paragraph $paragraph */
  $paragraph = $variables['paragraph'];
  if ($variables['view_mode'] == "facebook_instant_articles_rss" && $paragraph instanceof Paragraph) {

    // Force 'basic_html' for text paragraphs.
    if ($paragraph
      ->getType() == 'text') {
      $variables['content']['field_text'][0]['#format'] = "basic_html";
    }
  }
}