You are here

function party_user_party_from_user_context in Party 7

Same name and namespace in other branches
  1. 8.2 modules/party_user/plugins/relationships/party_from_user.inc \party_user_party_from_user_context()

Return a new context based on an existing context.

1 string reference to 'party_user_party_from_user_context'
party_from_user.inc in modules/party_user/plugins/relationships/party_from_user.inc
CTools Relationship to get a Party from a User

File

modules/party_user/plugins/relationships/party_from_user.inc, line 21
CTools Relationship to get a Party from a User

Code

function party_user_party_from_user_context($context, $conf) {

  // If unset it wants a generic, unfilled context, which is just NULL.
  if (empty($context->data)) {
    return ctools_context_create_empty('entity:party', NULL);
  }
  $party = party_user_get_party($context->data);
  if ($party) {
    return ctools_context_create('entity:party', $party);
  }
  return ctools_context_create_empty('entity:party', NULL);
}