You are here

function panels_admin_content_custom in Panels 6.2

Same name and namespace in other branches
  1. 5.2 content_types/custom.inc \panels_admin_content_custom()

Render callback for when the custom content is in the editor so that people can have a preview on the spot.

Parameters

panels_display $display:

stdClass $pane:

Return value

stdClass $block

1 string reference to 'panels_admin_content_custom'
panels_custom_panels_content_types in content_types/custom.inc
Callback function to supply a list of content types.

File

content_types/custom.inc, line 47

Code

function panels_admin_content_custom($display, $pane) {
  $block = new stdClass();
  $block->title = filter_xss_admin($pane->configuration['title']);

  // We don't want to render php output on preview here, because if something is
  // wrong the whole display will be borked. So we check to see if the php
  // evaluator filter is being used, and make a temporary change to the filter
  // so that we get the printed php, not the eval'ed php.
  $php_filter = FALSE;
  foreach (filter_list_format($pane->configuration['format']) as $filter) {
    if ($filter->name == 'PHP evaluator') {

      // TODO stupid way to check
      $php_filter = TRUE;
    }
  }

  // If a php filter is active, pass 1 to use core's most restrictive filter.
  $block->content = check_markup($pane->configuration['body'], $php_filter ? 1 : $pane->configuration['format']);
  return $block;
}