/**
  * Overrides Drupal\Core\Entity\EntityRenderController::buildContent().
  */
 public function buildContent(array $entities, array $displays, $view_mode, $langcode = NULL)
 {
     if (empty($entities)) {
         return;
     }
     // if
     parent::buildContent($entities, $displays, $view_mode, $langcode);
     foreach ($entities as $key => $entity) {
         $bundle = $entity->bundle();
         $display = $displays[$bundle];
         // Add short preview field element to font render array.
         if ($display->getComponent('preview')) {
             $entity->content['preview'] = array('#type' => 'item', '#markup' => 'TEST', '#prefix' => '<div class="field-preview-display">', '#suffix' => '</div>');
         }
         // if
         if ($display->getComponent('enable')) {
             if ($entity->enabled) {
                 $link = l('Disable', 'admin/config/fontyourface/font/' . $entity->fid);
             } else {
                 $link = l('Enable', 'admin/config/fontyourface/font/' . $entity->fid);
             }
             // else
             $entity->content['enable'] = array('#type' => 'item', '#markup' => $link, '#prefix' => '<div class="field-enable-display">', '#suffix' => '</div>');
         }
         // if
     }
     // foreach
 }
Пример #2
0
 /**
  * Overrides Drupal\Core\Entity\EntityRenderController::buildContent().
  */
 public function buildContent(array $feeds, array $displays, $view_mode, $langcode = NULL)
 {
     $return = array();
     if (empty($feeds)) {
         return $return;
     }
     parent::buildContent($feeds, $displays, $view_mode, $langcode);
     foreach ($feeds as $key => $feed) {
         $importer = $feed->bundle();
         $display = $displays[$importer];
         $feed->content['feed_status'] = $this->getStatus($feed);
     }
 }