function ctools_custom_content_type_admin_info

Callback to provide administrative info. In this case we'll render the content as long as it's not PHP, which is too risky to render here.

File

plugins/content_types/custom/custom.inc, line 231

Code

function ctools_custom_content_type_admin_info($subtype, $conf) {
    $settings = ctools_custom_content_type_get_conf(ctools_custom_content_type_content_type($subtype), $conf);
    $block = new stdClass();
    $block->title = filter_xss_admin($settings['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($settings['format']) as $filter) {
        if ($filter->module == 'php') {
            $php_filter = TRUE;
            break;
        }
    }
    // If a php filter is active, just print the source, but only if the current
    // user has access to the actual filter.
    if ($php_filter) {
        $filter = filter_format_load($settings['format']);
        if (!filter_access($filter)) {
            return NULL;
        }
        $block->content = '<pre>' . check_plain($settings['body']) . '</pre>';
    }
    else {
        // We also need to filter through XSS admin because <script> tags can
        // cause javascript which will interfere with our ajax.
        $block->content = filter_xss_admin(check_markup($settings['body'], $settings['format']));
    }
    return $block;
}