I had previously used calendar to display nodes with the stripe being coloured by their taxonomy group. This worked brilliantly.
I am now in the process of moving my nodes to Organic Groups and noticed the "Calendar Entities" settings have an option for Stripes based on OG. However, this does not seem to work. I first tried with 7.x-3.4 and then 7.x-3.x-dev. Am I doing something wrong or is this function not fully enabled?
Thanks

CommentFileSizeAuthor
#3 og_stripe-2125677-2.patch69 byteskim-odisee
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mweber’s picture

Same problem here. Thought it would work with the "Group audience" field, but it obviously doesn't. Tried relationships and other fields, but it just doesn't work.

technivant’s picture

If you use og-7.x-2.x, I was able to resolve this by modifying calendar/includes/calendar_plugin_row.inc:

/**
   * Create a stripe based on group.
   */
  function calendar_group_stripe(&$result) {
    $colors = isset($this->options['colors']['calendar_colors_group']) ? $this->options['colors']['calendar_colors_group'] : array();

    if (empty($colors)) {
      return;
    }
    if (!function_exists('og_get_entity_groups')) {
      return;
    }

    $entity = $result->entity;
    $groups_for_entity = og_get_entity_groups($this->view->base_table, $entity);

    // The 7.1 version of OG.
    if (function_exists('og_label')) {
      if (count($groups_for_entity)) {
        foreach ($groups_for_entity as $gid => $group_name) {
          if (!array_key_exists($gid, $colors) || $colors[$gid] == CALENDAR_EMPTY_STRIPE) {
            continue;
          }
          $result->stripe[] = $colors[$gid];
          $result->stripe_label[] = $group_name;
        }
      }
    }
    // The 7.2 version of OG.
    else {
      if (count($groups_for_entity)) {
        foreach ($groups_for_entity as $entity_type => $gids) {
          foreach ($gids as $gid) {
            if (!array_key_exists($gid, $colors) || $colors[$gid] == CALENDAR_EMPTY_STRIPE) {
              continue;
            }

            $result->stripe[] = $colors[$gid];
            $result->stripe_label[] = $gid;
          }
        }
      }
    }
    return;
  }
kim-odisee’s picture

FileSize
69 bytes

I've created a patch for #2

kim-odisee’s picture

morybel’s picture

#2 solved it for me. Thank technivant !!! Was looking for this since a bit.

Mixologic’s picture

Neslee Canil Pinto’s picture

Status: Active » Closed (outdated)