You are here

function theme_spaces_button in Spaces 5

Generates a themed set of links for node types associated with the current active contexts.

4 theme calls to theme_spaces_button()
spaces_core_documents in spaces_core/spaces_core.module
spaces_dashboard_group_dashboard in spaces_dashboard/spaces_dashboard.module
Implements a group dashboard for users in multiple groups TODO: implement "fires" listing
_spaces_block_tools in ./spaces_block.inc
_spaces_views_empty in ./spaces_views.inc
Function that handles a variety of tasks needed when view is empty

File

./spaces.module, line 1327

Code

function theme_spaces_button() {
  $output = '';
  $links = _context_ui_node_links();

  // Perform additional logic if a spaces feature is active.
  if ($feature = context_get('spaces', 'feature')) {

    // Are we in an enabled, accessible feature?
    if (spaces_gid() && (!spaces_is_member() || !spaces_feature($feature))) {
      $features = spaces_features();
      if (isset($features[$feature]->node)) {
        foreach ($features[$feature]->node as $type) {
          unset($links[$type]);
        }
      }
    }
    else {
      if (!spaces_gid()) {

        // strip out all OG-enabled types from $links array
        foreach ($links as $type => $link) {
          if (!og_is_omitted_type($type) && !og_is_group_type($type)) {
            unset($links[$type]);
          }
        }
      }
    }
  }
  if (context_isset('spaces', 'links')) {
    $links = array_merge($links, context_get('spaces', 'links'));
  }
  foreach ($links as $link) {
    if ($link['custom']) {
      $output .= l($link['title'], $link['href'], array(
        'class' => 'button',
      ));
    }
    else {
      if (!empty($link)) {
        $output .= l('+ ' . t('Add !type', array(
          '!type' => $link['title'],
        )), $link['href'], array(
          'class' => 'button',
        ));
      }
    }
  }
  return $output;
}