You are here

function ctools_custom_content_type_render in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 plugins/content_types/custom/custom.inc \ctools_custom_content_type_render()

Output function for the 'custom' content type. Outputs a custom based on the module and delta supplied in the configuration.

File

plugins/content_types/custom/custom.inc, line 176
Custom content type.

Code

function ctools_custom_content_type_render($subtype, $conf, $args, $contexts) {
  $settings = ctools_custom_content_type_get_conf(ctools_custom_content_type_content_type($subtype), $conf);
  static $delta = 0;
  $block = new stdClass();
  $block->subtype = ++$delta;
  $block->title = filter_xss_admin($settings['title']);
  $block->title_heading = isset($settings['title_heading']) ? $settings['title_heading'] : 'h2';

  // Add keyword substitutions if we were configured to do so.
  $content = $settings['body'];
  if (!empty($contexts) && !empty($settings['substitute'])) {
    $content = ctools_context_keyword_substitute($content, array(), $contexts);
  }
  $block->content = check_markup($content, $settings['format']);
  if ($settings['custom_type'] == 'fixed' && user_access('administer custom content')) {
    $block->admin_links = array(
      array(
        'title' => t('Configure content pane'),
        'alt' => t("Configure this pane in administer >> structure >> custom content panes"),
        'href' => 'admin/structure/ctools-content/list/' . $settings['content']->name . '/edit',
        'query' => drupal_get_destination(),
      ),
    );
  }
  return $block;
}