You are here

function access_grant_build_content in Access Control Kit 7

Builds a structured array representing the access grant in $grant->content.

Parameters

object $grant: An access grant.

string $view_mode: (optional) The view mode. Defaults to 'full'.

string|null $langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request.

1 call to access_grant_build_content()
access_grant_view in ./access.module
Generates a renderable array for an access grant.

File

./access.module, line 293
The access control kit module.

Code

function access_grant_build_content($grant, $view_mode = 'full', $langcode = NULL) {
  if (!isset($langcode)) {
    $langcode = $GLOBALS['language_content']->language;
  }

  // Remove previously built content, if any exists.
  $grant->content = array();

  // Build fields content. An internal flag prevents this from happening twice,
  // such as when called through access_grant_view_multiple().
  field_attach_prepare_view('access_grant', array(
    $grant->gid => $grant,
  ), $view_mode, $langcode);
  entity_prepare_view('access_grant', array(
    $grant->gid => $grant,
  ), $langcode);
  $grant->content += field_attach_view('access_grant', $grant, $view_mode, $langcode);
  module_invoke_all('access_grant_view', $grant, $view_mode, $langcode);
  module_invoke_all('entity_view', $grant, 'access_grant', $view_mode, $langcode);
}