/**
 * Extract the specified array fields from the current or specified page.
 * Build a l() 'query' array suitable for use by Prepopulate.
 *
 * @param $fields
 *   Array of fields to process.
 * @param path
 *   If NULL, the current page. Otherwise, lookup the path and use that page.
 *   (Path lookup not yet implemented)
 *
 * @see freelinking_prepopulate_list_fields(), l()
 */
function freelinking_prepopulate_fields_from_page($fields, $plugin = 'nodecreate', $path = NULL)
{
    static $prepopulate;
    $query = array();
    $index = $plugin . serialize($fields);
    if (!$prepopulate[$index]) {
        $prepopulate[$index] = array_intersect_key(freelinking_prepopulate_list_fields($plugin), $fields);
    }
    if ($plugin == 'nodecreate' && arg(0) == 'node' && is_numeric(arg(1)) && !arg(2)) {
        $object = node_load(arg(1));
    }
    foreach ($prepopulate[$index] as $field => $definition) {
        switch ($field) {
            case 'og':
                $group = og_get_group_context();
                $query[$definition['prepopulate']] = $group->nid;
                break;
            case 'book':
                if ($node->book) {
                    $query['parent'] = $object->book['mlid'];
                }
                break;
            default:
                if ($object->{$field}) {
                    $query[$definition['prepopulate']] = $object->field;
                }
                break;
        }
    }
    return $query;
}
<?php

// $Id: page.tpl.php,v 1.1.2.1 2009/02/24 15:34:45 dvessel Exp $
/**
 * Put community specific information into variables
 */
$logotitle = '';
$commpath = '';
$commcss = '';
$group_node = og_get_group_context();
if ($group_node) {
    $logotitle = $group_node->title;
    $commpath = strtolower(str_replace(' ', '', $logotitle));
    $commcss = base_path() . path_to_theme() . '/styles/' . $commpath . '.css';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php 
/**
 * Customized home page template for "sample" community 
 */
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
print $language->language;
?>
" lang="<?php 
print $language->language;
?>
" dir="<?php 
print $language->dir;
?>
function ogplcommunities_tagadelic_weighted($terms)
{
    $output = '';
    $node = og_get_group_context();
    $item = menu_get_item();
    foreach ($terms as $term) {
        switch ($item['path']) {
            case "node/%/blogs":
                $output .= l($term->name, "node/{$node->nid}/blogs", array('attributes' => array('class' => "tagadelic level{$term->weight}", 'rel' => 'tag'), 'query' => array('tid' => $term->name))) . " \n";
                break;
            case "node/%/data_tools":
                $output .= l($term->name, "node/{$node->nid}/data_tools", array('attributes' => array('class' => "tagadelic level{$term->weight}", 'rel' => 'tag'), 'query' => array('tid' => $term->name))) . " \n";
                break;
            default:
                $output .= l($term->name, taxonomy_term_path($term), array('attributes' => array('class' => "tagadelic level{$term->weight}", 'rel' => 'tag'))) . " \n";
                break;
        }
    }
    return $output;
}
Example #4
0
/**
 * Implements hook_preprocess_ID().
 */
function commonpassion_preprocess_page(&$vars)
{
    if ($group_node = og_get_group_context()) {
        $vars['logo'] = base_path() . COMMONPASSION_PATH . '/images/hosted-by-cp.gif';
    }
}
/**
 * Override or insert variables into the page templates.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("page" in this case.)
 */
function vojo_generic_preprocess_page(&$vars, $hook)
{
    // If we're in a group context, use group logo and header color provided by
    // fields in the group node.
    $group_node = og_get_group_context();
    if ($group_node) {
        $vars['title_group'] = $group_node->title;
        $navigation_block = module_invoke('vojo_og', 'block', 'view', 'generic-group-menu');
        $vars['group_menu'] = $navigation_block['content'];
    }
    if (!empty($group_node) && $group_node->field_group_logo[0]['filepath']) {
        $image_path = imagecache_create_url('group_logo_large', $group_node->field_group_logo[0]['filepath']);
        $vars['group_logo'] = '<img src="' . $image_path . '" />';
    }
    if (!empty($group_node)) {
        $vars['home_link'] = url('node/' . $group_node->nid);
    }
    // If the colorpicker module is present, the vozmob_og feature will provide a
    // field to the group node to select the background color of the header.
    if (isset($group_node->field_group_header_bg_color)) {
        $vars['header_bg_color'] = $group_node->field_group_header_bg_color[0]['value'];
    }
    if (!$vars['show_blocks']) {
        $vars['sidebar'] = '';
    }
}
Example #6
0
function afg_markup($element) {
  if (strpos($element['#value'], 'og/users')) {
    $og = og_get_group_context();
    $element['#value'] = l('Cancel', $og->purl . '/supporters');
  }
  return theme_markup($element);
}