You are here

function party_user_user_from_party_context in Party 7

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

Return a new context based on an existing context.

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

File

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

Code

function party_user_user_from_party_context($context, $conf) {

  // If unset it wants a generic, unfilled context, which is just NULL.
  if (empty($context->data)) {
    return ctools_context_create_empty('user', NULL);
  }
  $user = $context->data
    ->getDataSetController('user')
    ->getEntities();
  $user = !empty($user) ? reset($user) : NULL;
  if ($user) {
    return ctools_context_create('user', $user);
  }
}