You are here

function contemplate_admin in Content Templates (Contemplate) 6

Same name and namespace in other branches
  1. 5 contemplate.module \contemplate_admin()
  2. 7 contemplate.module \contemplate_admin()

Admin page... list out the node types

Return value

html Content Template Admin table

1 call to contemplate_admin()
contemplate_edit_type in ./contemplate.module

File

./contemplate.module, line 198
Create templates to customize teaser and body content.

Code

function contemplate_admin() {
  $destination = drupal_get_destination();
  contemplate_refresh_files();
  $types = node_get_types();
  $templates = contemplate_get_templates();
  $enabled = t('Enabled: Textfield');
  $disabled = t('Disabled');
  $file = t('Enabled: Disk');
  foreach ($types as $type) {
    $type_url_str = str_replace('_', '-', $type->type);
    $rows[] = array(
      $type->name,
      isset($templates[$type->type]['teaser-enabled']) ? $templates[$type->type]['teaser-enabled'] ? $templates[$type->type]['teaser-file'] ? $file : $enabled : $disabled : '',
      isset($templates[$type->type]['body-enabled']) ? $templates[$type->type]['body-enabled'] ? $templates[$type->type]['body-file'] ? $file : $enabled : $disabled : '',
      isset($templates[$type->type]['rss-enabled']) ? $templates[$type->type]['rss-enabled'] ? $templates[$type->type]['rss-file'] ? $file : $enabled : $disabled : '',
      l(isset($templates[$type->type]) ? t('edit template') : t('create template'), 'admin/content/node-type/' . $type_url_str . '/template'),
      isset($templates[$type->type]) ? l(t('delete template'), 'admin/content/node-type/' . $type_url_str . '/template/delete', array(
        'query' => $destination,
      )) : '',
    );
  }
  $header = array(
    t('Content type'),
    t('Teaser'),
    t('Body'),
    t('RSS'),
    '',
    '',
  );
  $output = t("To Enable a Content Template, You must first 'edit template' to enable a Content Template for a Content Type.");
  $output .= theme('table', $header, $rows);
  return $output;
}