BlockquoteFormatter.php in Facebook Instant Articles 8.2
File
src/Plugin/Field/FieldFormatter/BlockquoteFormatter.php
View source
<?php
namespace Drupal\fb_instant_articles\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FieldItemListInterface;
use Facebook\InstantArticles\Elements\Blockquote;
use Facebook\InstantArticles\Elements\InstantArticle;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class BlockquoteFormatter extends FormatterBase {
public function viewInstantArticle(FieldItemListInterface $items, InstantArticle $article, $region, NormalizerInterface $normalizer, $langcode = NULL) {
foreach ($items as $delta => $item) {
$article
->addChild(Blockquote::create()
->appendText($item->value));
}
}
}