From 05420fde76b402a8c29e159d3fe78a142341f6d1 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Sun, 2 Nov 2008 10:52:53 +0000 Subject: [PATCH] - Patch #302120 by dmitrig01: usability improvement - make the content type admin screen prettier. --- CHANGELOG.txt | 1 + modules/node/content_types.inc | 19 +++++++++++-------- modules/node/node.module | 3 +++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index e419c23c6ffc..ad1d2615e2bb 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -29,6 +29,7 @@ Drupal 7.0, xxxx-xx-xx (development version) file copy to the includes directory). * Added an edit tab to taxonomy term pages. * Redesigned password strength validator. + * Redesigned the add content type screen. - News aggregator: * Added OPML import functionality for RSS feeds. * Optionally, RSS feeds may be configured to not automatically generate feed blocks. diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc index 826deac83a50..c8202504764a 100644 --- a/modules/node/content_types.inc +++ b/modules/node/content_types.inc @@ -12,18 +12,14 @@ function node_overview_types() { $types = node_get_types(); $names = node_get_types('names'); - $header = array(t('Name'), t('Type'), t('Description'), array('data' => t('Operations'), 'colspan' => '2')); + $header = array(t('Name'), array('data' => t('Operations'), 'colspan' => '2')); $rows = array(); foreach ($names as $key => $name) { $type = $types[$key]; if (node_hook($type, 'form')) { $type_url_str = str_replace('_', '-', $type->type); - $row = array( - check_plain($name), - check_plain($type->type), - filter_xss_admin($type->description), - ); + $row = array(theme('node_admin_overview', $name, $type)); // Set the edit column. $row[] = array('data' => l(t('edit'), 'admin/build/node-type/' . $type_url_str)); @@ -45,6 +41,13 @@ function node_overview_types() { return theme('table', $header, $rows); } +function theme_node_admin_overview($name, $type) { + $output = check_plain($name); + $output .= ' <small> (Machine name: ' . check_plain($type->type) . ')</small>'; + $output .= '<div class="description">' . filter_xss_admin($type->description) . '</div>'; + return $output; +} + /** * Generates the node type editing form. */ @@ -71,7 +74,7 @@ function node_type_form(&$form_state, $type = NULL) { if (!$type->locked) { $form['identity']['type'] = array( - '#title' => t('Type'), + '#title' => t('Machine name'), '#type' => 'textfield', '#default_value' => $type->type, '#maxlength' => 32, @@ -85,7 +88,7 @@ function node_type_form(&$form_state, $type = NULL) { '#value' => $type->type, ); $form['identity']['type_display'] = array( - '#title' => t('Type'), + '#title' => t('Machine name'), '#type' => 'item', '#markup' => theme('placeholder', $type->type), '#description' => t('The machine-readable name of this content type. This field cannot be modified for system-defined content types.'), diff --git a/modules/node/node.module b/modules/node/node.module index 5c4bc884a982..473eb857d1eb 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -135,6 +135,9 @@ function node_theme() { 'node_submitted' => array( 'arguments' => array('node' => NULL), ), + 'node_admin_overview' => array( + 'arguments' => array('name' => NULL, 'type' => NULL), + ), ); } -- GitLab