You are here

function language_access_node_view_alter in Language access 7

Implements hook_node_view_alter().

File

./language_access.module, line 70

Code

function language_access_node_view_alter(&$build) {
  if (isset($build['links']['translation']['#links'])) {
    $links =& $build['links']['translation']['#links'];

    // Check if user has permission to language link and disable it if false
    foreach ($links as $link => $language_code) {
      if (!user_access('access language ' . $language_code['language']->language)) {
        unset($links[$link]);
      }
    }
  }
}