--- includes/common.inc +++ includes/common.inc @@ -5441,6 +5441,9 @@ function drupal_common_theme() { 'item_list' => array( 'variables' => array('items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => array()), ), + 'definition_list' => array( + 'variables' => array('items' => array(), 'title' => NULL, 'attributes' => array()), + ), 'more_help_link' => array( 'variables' => array('url' => NULL), ), --- includes/theme.inc +++ includes/theme.inc @@ -1958,6 +1958,82 @@ function theme_item_list($variables) { } /** + * Return a themed list of definition items. + * @param $variables + * An associative array containing: + * - items: An array of items ($key => $value) to be displayed in the + * definition list. Key $key is used as definition term. Value $value is + * used for the definition. If $value is a string, it is used as is. + * If $value is an array, the items of that array are used as multiple + * definitions for the term. If $value is an array it can contain special + * items: 'term' for overriding the $key as definition term, 'attributes' + * for adding special attributes to the dt element. Other items of $value + * can be strings or arrays. In case of an array the following fields are + * used: 'data' as definition, 'attributes' for extra attributes of the dd + * element, 'children' for a nested definition list. + * - title: The title of the definition list. + * - attributes: The attributes applied to the definition list element. + * @return + * A string containing the definition list output. + */ +function theme_definition_list($variables) { + $items = $variables['items']; + $title = $variables['title']; + $attributes = $variables['attributes']; + + $output = '
'; + if (isset($title)) { + $output .= '

'. $title .'

'; + } + + if (!empty($items)) { + $output .= ''; + foreach ($items as $term => $item) { + // get definition(s) and attributes for current term (and possibly an override for the term) + $definitions = array(); + $attributes = array(); + if (is_array($item)) { + foreach ($item as $key => $value) { + if ($key === 'term') { + $term = $value; + } + elseif ($key === 'attributes') { + $attributes = $value; + } + else { + $definitions[] = $value; + } + } + } + else { + $definitions[] = $item; + } + // output definition term + $output .= ''. $term .''; + // iterate over definition(s) + foreach ($definitions as $definition) { + if (is_array($definition)) { + // complex definition item: get data, attributes and children + $data = $definition['data']; + $attributes = (array)($definition['attributes']); + if (isset($definition['children'])) { + $data .= theme_definition_list($definition['children'], NULL, $attributes); + } + $output .= '' . $data .''; + } + else { + // simple definition item + $output .= '
' . $definition .'
'; + } + } + } + $output .= ''; + } + $output .= '
'; + return $output; +} + +/** * Returns code that emits the 'more help'-link. */ function theme_more_help_link($variables) { --- modules/node/node.module +++ modules/node/node.module @@ -84,18 +84,14 @@ function node_help($path, $arg) { $output .= '

' . t('About') . '

'; $output .= '

' . t('The Node module manages the creation, editing, deletion, settings, and display of all site content. For more information, see the online handbook entry for Node module.', array('@node' => 'http://drupal.org/handbook/modules/node')) . '

'; $output .= '

' . t('Uses') . '

'; - $output .= '
'; - $output .= '
' . t('Creating content') . '
'; - $output .= '
' . t('When new content is created, the Node module records basic information about the content, including the author, date of creation, and the Content type. It also manages the publishing options, which define whether or not the content is published, promoted to the front page of the site, and/or sticky at the top of content lists. Default settings can be configured for each type of content on your site.', array('@content-type' => url('admin/structure/types'))) . '
'; - $output .= '
' . t('Creating custom content types') . '
'; - $output .= '
' . t('The Node module gives users with the Administer content types permission the ability to create new content types in addition to the default ones already configured. Creating custom content types allows you the flexibility to add fields and configure default settings that suit the differing needs of various site content.', array('@content-new' => url('admin/structure/types/add'), '@field' => url('admin/help/field'))) . '
'; - $output .= '
' . t('Administering content') . '
'; - $output .= '
' . t('The Content administration page allows you to review and bulk manage your site content.', array('@content' => url('admin/content'))) . '
'; - $output .= '
' . t('Creating revisions') . '
'; - $output .= '
' . t('The Node module also enables you to create multiple versions of any content, and revert to older versions using the Revision information settings.') . '
'; - $output .= '
' . t('User permissions') . '
'; - $output .= '
' . t('The Node module makes a number of permissions available for each content type, which can be set by role on the permissions page.', array('@permissions' => url('admin/settings/permissions'))) . '
'; - $output .= '
'; + $items = array( + t('Creating content') => t('When new content is created, the Node module records basic information about the content, including the author, date of creation, and the Content type. It also manages the publishing options, which define whether or not the content is published, promoted to the front page of the site, and/or sticky at the top of content lists. Default settings can be configured for each type of content on your site.', array('@content-type' => url('admin/structure/types'))), + t('Creating custom content types') => t('The Node module gives users with the Administer content types permission the ability to create new content types in addition to the default ones already configured. Creating custom content types allows you the flexibility to add fields and configure default settings that suit the differing needs of various site content.', array('@content-new' => url('admin/structure/types/add'), '@field' => url('admin/help/field'))), + t('Administering content') => t('The Content administration page allows you to review and bulk manage your site content.', array('@content' => url('admin/content'))), + t('Creating revisions') => t('The Node module also enables you to create multiple versions of any content, and revert to older versions using the Revision information settings.'), + t('User permissions') => t('The Node module makes a number of permissions available for each content type, which can be set by role on the permissions page.', array('@permissions' => url('admin/settings/permissions'))), + ); + $output .= theme('definition_list', array('items' => $items)); return $output; case 'admin/content':