You are here

function _spaces_views_empty in Spaces 5

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

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

File

./spaces_views.inc, line 18

Code

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

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