You are here

function total_control_create_content_type_render in Total Control Admin Dashboard 7.2

Same name and namespace in other branches
  1. 6.2 plugins/content_types/create.inc \total_control_create_content_type_render()
  2. 6 plugins/content_types/create.inc \total_control_create_content_type_render()

Run-time rendering of the body of the pane.

File

plugins/content_types/create.inc, line 43

Code

function total_control_create_content_type_render($subtype, $conf, $panel_args, &$context) {
  $block = new stdClass();
  $block->module = t('total_control');
  $block->title = t('Create content');
  $types = node_type_get_types();
  $create = array();
  foreach ($types as $type => $object) {

    // Check against pane config for type.
    if (!array_key_exists($type, $conf['types']) || isset($conf['types']) && $conf['types'][$type]) {

      // Check access, then add a link to create content.
      if (node_access('create', $type)) {
        $type_url_str = str_replace('_', '-', $object->type);
        $create[] = l(t('Add new  ' . $object->name), 'node/add/' . $type_url_str);
      }
    }
  }
  $block->content = theme('total_control_create', array(
    'create' => $create,
  ));
  return $block;
}