You are here

function contemplate_admin in Content Templates (Contemplate) 7

Same name and namespace in other branches
  1. 5 contemplate.module \contemplate_admin()
  2. 6 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
1 string reference to 'contemplate_admin'
contemplate_menu in ./contemplate.module
Implements hook_menu().

File

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

Code

function contemplate_admin() {
  $destination = drupal_get_destination();
  contemplate_refresh_files();
  $types = node_type_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/structure/types/manage/' . $type_url_str . '/template'),
      isset($templates[$type->type]) ? l(t('delete template'), 'admin/structure/types/manage/' . $type_url_str . '/template/delete', array(
        'query' => $destination,
      )) : '',
    );
  }
  $header = array(
    t('content type'),
    t('Teaser'),
    t('Body'),
    t('RSS'),
    '',
    '',
  );
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
}