You are here

public function SlickParagraphsVanillaFormatter::prepareView in Slick Paragraphs 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/SlickParagraphsVanillaFormatter.php \Drupal\slick_paragraphs\Plugin\Field\FieldFormatter\SlickParagraphsVanillaFormatter::prepareView()

File

src/Plugin/Field/FieldFormatter/SlickParagraphsVanillaFormatter.php, line 28

Class

SlickParagraphsVanillaFormatter
Plugin implementation of the 'Slick Paragraphs Vanilla' formatter.

Namespace

Drupal\slick_paragraphs\Plugin\Field\FieldFormatter

Code

public function prepareView(array $entities_items) {

  // Entity revision loading currently has no static/persistent cache and no
  // multiload. As entity reference checks _loaded, while we don't want to
  // indicate a loaded entity, when there is none, as it could cause errors,
  // we actually load the entity and set the flag.
  foreach ($entities_items as $items) {
    foreach ($items as $item) {
      if ($item->entity) {
        $item->_loaded = TRUE;
      }
    }
  }
}