You are here

function _entity_print_get_generated_html in Entity Print 7

Generate the HTML for our entity.

Parameters

string $entity_type: The entity type.

object $entity: The entity we're rendering.

Return value

string The generate HTML.

Throws

\Exception

2 calls to _entity_print_get_generated_html()
entity_print_entity_debug in ./entity_print.module
A debug callback for styling up the PDF.
entity_print_entity_to_pdf in ./entity_print.module
Output an entity as a PDF.

File

./entity_print.module, line 152
Print any entity.

Code

function _entity_print_get_generated_html($entity_type, $entity) {
  $info = entity_get_info($entity_type);
  $entity_id = $entity->{$info['entity keys']['id']};
  $html_array = entity_view($entity_type, array(
    $entity,
  ), 'pdf');

  // Inject some generic CSS across all templates.
  if (variable_get('entity_print_default_css', TRUE)) {
    entity_print_add_css(drupal_get_path('module', 'entity_print') . '/css/entity-print.css');
  }

  // Inject CSS from the theme info files.
  $entity_print_css = _entity_print_get_css($entity_type, $entity, $info);
  return theme('entity_print__' . $entity_type . '__' . $entity_id, array(
    'entity_array' => $html_array,
    'entity' => $entity,
    'entity_print_css' => $entity_print_css,
  ));
}