You are here

public function PopupOnLoadController::buildContent in Popup On Load 7

Implements EntityAPIControllerInterface::buildContent().

Parameters

array $content: Optionally. Allows pre-populating the built content to ease overridding this method.

Overrides EntityAPIController::buildContent

File

./popup_onload.entity.inc, line 89
Popupad entity model and controller classes.

Class

PopupOnLoadController
PopupOnLoadControllerController extends DrupalDefaultEntityController.

Code

public function buildContent($entity, $view_mode = 'full', $langcode = NULL, $content = []) {
  $content['body'] = [
    '#theme' => 'field',
    '#weight' => 0,
    '#title' => t('Body'),
    '#access' => TRUE,
    '#label_display' => 'hidden',
    '#view_mode' => $view_mode,
    '#language' => $langcode ? $langcode : LANGUAGE_NONE,
    '#field_name' => 'field_fake_body',
    '#field_type' => 'text',
    '#entity_type' => 'popup_onload',
    '#bundle' => $entity->bundle_type,
    '#items' => [
      [
        'value' => $entity->body,
      ],
    ],
    '#formatter' => 'text_default',
    0 => [
      '#markup' => check_markup($entity->body, $entity->format),
    ],
  ];
  return parent::buildContent($entity, $view_mode, $langcode, $content);
}