You are here

function PanelizerEntityNode::render_entity in Panelizer 7.3

Render the panels display for a given panelizer entity.

Parameters

stdClass $entity: A fully-loaded entity object controlled by panelizer.

array $args: Optional array of arguments to pass to the panels display.

string $address: An optional address to send to the renderer to use for addressable content.

array $extra_contexts: An optional array of extra context objects that will be added to the display.

Return value

array If the entity isn't panelized, this returns NULL. Otherwise, it returns an associative array as meant for use with CTools with the following keys:

  • 'content': String containing the rendered panels display output.
  • 'no_blocks': Boolean defining if the panels display wants to hide core blocks or not when being rendered.

Overrides PanelizerEntityDefault::render_entity

File

plugins/entity/PanelizerEntityNode.class.php, line 259
Class for the Panelizer node entity plugin.

Class

PanelizerEntityNode
Panelizer Entity node plugin class.

Code

function render_entity($entity, $view_mode, $langcode = NULL, $args = array(), $address = NULL, $extra_contexts = array()) {
  $info = parent::render_entity($entity, $view_mode, $langcode, $args, $address, $extra_contexts);
  if (!empty($info)) {
    if (!empty($entity->promote)) {
      $info['classes_array'][] = 'node-promoted';
    }
    if (!empty($entity->sticky)) {
      $info['classes_array'][] = 'node-sticky';
    }
    if (empty($entity->status)) {
      $info['classes_array'][] = 'node-unpublished';
    }
  }
  return $info;
}