Commit b7679763 authored by Marco Villegas's avatar Marco Villegas
Browse files

Added a function to check is a repository has a project associated.

parent d5060ea0
Loading
Loading
Loading
Loading
+15 −0
Changes for versioncontrol_project.module: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -186,6 +186,21 @@ function versioncontrol_project_repository_load($project_id) {
  return FALSE;
}

/**
 * Asks if a versioncontrol repository has a valid project associated.
 *
 * @return boolean
 *   TRUE if the repository has a valid project associated, FALSE if not.
 */
function versioncontrol_project_repository_has_project(VersioncontrolRepository $repository) {
  if (empty($repository->project_nid)) {
    // No project associated.
    return FALSE;
  }
  $node = node_load($repository->project_nid);
  return project_node_is_project($node);
}

/**
 * Load the project object associated with a repo.
 */