From 9438279fd24e0309abd1f78a9442b149f7bd6bef Mon Sep 17 00:00:00 2001 From: bboldi Date: Tue, 13 Sep 2011 12:08:50 +0200 Subject: Initial commit. --- drupal6_theme_methods.php | 276 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 276 insertions(+) create mode 100644 drupal6_theme_methods.php (limited to 'drupal6_theme_methods.php') diff --git a/drupal6_theme_methods.php b/drupal6_theme_methods.php new file mode 100644 index 0000000..a606bc9 --- /dev/null +++ b/drupal6_theme_methods.php @@ -0,0 +1,276 @@ +]*>([^<]*)~', + ''. + ''. + ''. + '$2', $link); + return '
  • '.$output.'
  • '; +} + +/** + * Return code that emits an feed icon. + * + * @param $url + * The url of the feed. + * @param $title + * A descriptive title of the feed. + */ +function b2_silly_clouds_feed_icon($url, $title) { + return ''; +} + +/** + * Add a "Comments" heading above comments except on forum pages. + */ +function b2_silly_clouds_preprocess_comment_wrapper(&$vars) { + if (!isset($vars['content'])) return; + + ob_start();?> +
    +
    +
    + + type != 'forum') { + $result .= '

    ' . t('Comments') . '

    '; + } + + ob_start();?> +
    + + + +
    +
    + + + +
    + +
    +
    +
    + + '. implode(' | ', $breadcrumb) .''; + } +} + +function b2_silly_clouds_service_links_node_format($links) { + return ''; +} + +/** + * Theme a form button. + * + * @ingroup themeable + */ +function b2_silly_clouds_button($element) { + // Make sure not to overwrite classes. + if (isset($element['#attributes']['class'])) { + $element['#attributes']['class'] = 'form-'.$element['#button_type'].' '.$element['#attributes']['class'].' b2-button'; + } + else { + $element['#attributes']['class'] = 'form-'.$element['#button_type'].' b2-button'; + } + + return ''. + ''. + ''. + ''. + ''; +} + +/** + * Image assist module support. + * Added Artisteer styles in IE +*/ +function b2_silly_clouds_img_assist_page($content, $attributes = NULL) { + $title = drupal_get_title(); + $output = ''."\n"; + $output .= ''."\n"; + $output .= "\n"; + $output .= ''. $title ."\n"; + + // Note on CSS files from Benjamin Shell: + // Stylesheets are a problem with image assist. Image assist works great as a + // TinyMCE plugin, so I want it to LOOK like a TinyMCE plugin. However, it's + // not always a TinyMCE plugin, so then it should like a themed Drupal page. + // Advanced users will be able to customize everything, even TinyMCE, so I'm + // more concerned about everyone else. TinyMCE looks great out-of-the-box so I + // want image assist to look great as well. My solution to this problem is as + // follows: + // If this image assist window was loaded from TinyMCE, then include the + // TinyMCE popups_css file (configurable with the initialization string on the + // page that loaded TinyMCE). Otherwise, load drupal.css and the theme's + // styles. This still leaves out sites that allow users to use the TinyMCE + // plugin AND the Add Image link (visibility of this link is now a setting). + // However, on my site I turned off the text link since I use TinyMCE. I think + // it would confuse users to have an Add Images link AND a button on the + // TinyMCE toolbar. + // + // Note that in both cases the img_assist.css file is loaded last. This + // provides a way to make style changes to img_assist independently of how it + // was loaded. + $output .= drupal_get_html_head(); + $output .= drupal_get_js(); + $output .= "\n\n"; + // Ensure that img_assist.js is imported last. + $path = drupal_get_path('module', 'img_assist') .'/img_assist_popup.css'; + $output .= "\n"; + + $output .= ''."\n"; + $output .= ''."\n"; + $output .= ''."\n"; + + $output .= "\n"; + $output .= '\n"; + + $output .= theme_status_messages(); + + $output .= "\n"; + $output .= $content; + $output .= "\n"; + $output .= ''; + $output .= ''; + return $output; +} + +/** + * Display a node preview for display during node creation and editing. + * + * @param $node + * The node object which is being previewed. + * + * @ingroup themeable + */ +function b2_silly_clouds_node_preview($node) { + $output = '
    '; + + $preview_trimmed_version = FALSE; + // Do we need to preview trimmed version of post as well as full version? + if (isset($node->teaser) && isset($node->body)) { + $teaser = trim($node->teaser); + $body = trim(str_replace('', '', $node->body)); + + // Preview trimmed version if teaser and body will appear different; + // also (edge case) if both teaser and body have been specified by the user + // and are actually the same. + if ($teaser != $body || ($body && strpos($node->body, '') === 0)) { + $preview_trimmed_version = TRUE; + } + } + + if ($preview_trimmed_version) { + drupal_set_message(t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "<!--break-->" (without the quotes) to fine-tune where your post gets split.')); + + $preview_trimmed_version = t('Preview trimmed version'); + $output .= <<< EOT +
    +
    +
    + +
    + +

    + $preview_trimmed_version +

    + +
    +
    + + +
    + +
    +
    +
    + +EOT; + $output .= node_view(drupal_clone($node), 1, FALSE, 0); + + $preview_full_version = t('Preview full version'); + $output .= <<< EOT +
    +
    +
    + +
    + +

    + $preview_full_version +

    + +
    +
    + + +
    + +
    +
    +
    + +EOT; + + $output .= node_view($node, 0, FALSE, 0); + } + else { + $output .= node_view($node, 0, FALSE, 0); + } + $output .= "
    \n"; + + return $output; +} \ No newline at end of file -- cgit v1.2.3