You are here

function _spaces_views_empty in Spaces 5.2

Same name and namespace in other branches
  1. 5 spaces_views.inc \_spaces_views_empty()

Function that handles a variety of tasks needed when view is empty

File

./spaces_views.inc, line 61

Code

function _spaces_views_empty($feature, $block = false) {
  $features = spaces_features();

  // Check to see if user has access to this feature
  $space = spaces_get_space();
  if ($space && $space
    ->feature_access($feature) && ($types = $features[$feature]->node)) {
    $content_types = node_get_types();
    $type_name = $content_types[current($types)]->name;
    if (!$block) {
      $b = spaces_node_links();
      if ($b) {
        $m = "<p>" . t('Please click below to add your first @content.', array(
          '@content' => $type_name,
        )) . "</p>";
      }
      else {
        $m = "<p>" . t('No entries were found.', array(
          '@content' => $type_name,
        )) . "</p>";
      }
    }
    return $m . $b;
  }
  else {
    if ($block) {
      return '';
    }
    else {
      drupal_not_found();
      exit;
    }
  }
}