You are here

private function DrupalInstantArticleDisplay::fieldFormatSocialElement in Facebook Instant Articles 7

Formatter for the Social element.

Parameters

$items:

InstantArticle $body:

1 call to DrupalInstantArticleDisplay::fieldFormatSocialElement()
DrupalInstantArticleDisplay::fieldFormatterView in modules/fb_instant_articles_display/src/DrupalInstantArticleDisplay.php

File

modules/fb_instant_articles_display/src/DrupalInstantArticleDisplay.php, line 578
Contains \Drupal\fb_instant_articles_display\DrupalInstantArticleDisplay.

Class

DrupalInstantArticleDisplay
Facebook Instant Article node wrapper class. Builds up an InstantArticle object using field formatters.

Namespace

Drupal\fb_instant_articles_display

Code

private function fieldFormatSocialElement($items, $body) {
  foreach ($items as $delta => $item) {

    // @todo sanitize text before sending off to FB IA SDK?
    $social = SocialEmbed::create()
      ->withHTML($item['value']);
    $body
      ->addChild($social);
  }
}