'. $text .'

'; } /** * Theme a heading. * @param $text: the text to be included in the heading. Not translated here. * @param $level: the level of the heading (1 - 6). * @param $attributes: Optional attributes. * @return themed heading. */ function theme_heading($text, $level = 2, $attributes = array()) { if ($level > 6 || $level < 1) { drupal_set_message(t('Invalid heading level requested (@level).', array('@level' => $level)), 'error'); $level = 6; } return "'. $text .""; } /** * Theme a section of text with a desired style. * @param $style: the type of styling desired. Not translated here. * May be 'italics,' 'bold,' 'underline,' 'strikethrough,' 'delete,' 'insert'. * @param $text: the text to be stylized. Not translated here. * @return themed text or just the text if the style is invalid. */ function theme_style($style, $text) { $styles = array( 'big' => 'big', 'bold' => 'strong', 'delete' => 'del', 'insert' => 'ins', 'italics' => 'em', 'small' => 'small', 'strikethrough' => 'strike', 'underline' => 'u', ); if (isset($styles[$style])) { $tag = $styles[$style]; return "<$tag>". $text .""; } else { drupal_set_message(t('Invalid style type requested. (@bad)', array('@bad' => $style)), 'error'); return $text; } } /** * Theme an "empty" placeholder. Outputs a translated "not available" by default. * @param $message: Optional. Provide a translated message string. * @return a string that can be used as placeholder for non existing content. */ function theme_empty_placeholder($message = NULL) { $message = ($message ? $message : t("not available")); return ''. $message .''; } /** * Return a themed list of definition items. * Patch pending at http://drupal.org/node/54898 * @param $items * An array of items to be displayed in the list. * The argument is: array("term" => $term, "definitions" => $definitions) * If you provide the $definition as arrays, you will get multiple DDs with each DT. * If you provide the $definitions as a string, only one DD will be added to the DT. * @param $title * The title of the list. * @param $filter * Boolean value to define wether or not you wish to filter the input. Should be left TRUE, unless you sanitize your input yourself. * @return * A string containing the list output. */ function theme_definition_list($items = array(), $title = NULL, $filter = TRUE) { $output = '
'; if (isset($title)) { $output .= '

'. ($filter ? check_plain($title) : $title) .'

'; } if (!empty($items)) { $output .= "
"; foreach ($items as $item) { if (is_string($item['term'])) { $output .= '
'. ($filter ? check_plain($item['term']) : $item['term']) .'
'; } elseif (is_array($item['term'])) { foreach ($item['term'] as $term) { $output .= '
'. ($filter ? check_plain($term) : $term) ."
\n"; } } if (is_string($item['definitions'])) { $output .= '
'. ($filter ? filter_xss($item['definitions']) : $item['definitions']) .'
'; } elseif (is_array($item['definitions'])) { foreach ($item['definitions'] as $definition) { $output .= '
'. ($filter ? filter_xss($definition) : $definition) ."
\n"; } } } $output .= "
"; } $output .= '
'; return $output; } /** * Return a themed name and value as a DT DD pair. * @param $name * The name string. * @param $value * The value string. * @param $filter * Bool passed on to definition list. */ function theme_name_and_value_pair($name, $value, $filter = TRUE) { //simple version: return "$name: $value"; $items[] = array('term' => $name .':', 'definitions' => $value); return theme('definition_list', $items, NULL, $filter); } /** * Returns a themed "none" string, for usage in a select form. * In case you wish a general way of building the <none> strings. * @param $string optionally provide a string that goes in the place of the word "none". If you provide this, it will not be translated. */ function theme_none_option($string = NULL) { $string = ($string ? $string : t('none')); return '<'. $string .'>'; } /** * Function to theme the read more links * Drupal issue number 69571 * @ingroup themeable * @param $path a drupal path or full url to the full resource. Include http:// if you link to external resource. * @param $title an optional title that will provide a tooltip text when hovering over the link. */ function theme_read_more($path, $title = NULL) { if ($title) { $params['title'] = check_plain($title); } $params['class'] = 'read-more'; return l(t('read more'), $path, $params); } /** * Function to theme the a shortened string (see "shorten_string" above) * @ingroup themeable * @param $short_string The shortened string * @param $full_string The unshortened string, for display in the tooltip * @param $count_addition The amount of charanters that the calling function wants to be added. Defaults to three. Optional. */ function theme_shorten_string($short_string, $full_string, $count_addition = 3) { while ($i < $count_addition) { $i++; $addition .= '.'; } return ''. $short_string . $addition .''; }