You are here

public function LanguageApi::checkAccess in Little helpers 7.2

Same name and namespace in other branches
  1. 7 src/Locale/LanguageApi.php \Drupal\little_helpers\Locale\LanguageApi::checkAccess()

Check if the current logged-in user has access to a path.

1 call to LanguageApi::checkAccess()
LanguageApi::languageLinks in src/Locale/LanguageApi.php
Give paths to all (or a subset) of the available translations.

File

src/Locale/LanguageApi.php, line 22

Class

LanguageApi

Namespace

Drupal\little_helpers\Locale

Code

public function checkAccess($path, $langCode) {

  // Extra handling for front-page.
  if (empty($path)) {
    if (module_exists('i18n_variable')) {
      $path = \i18n_variable_get('site_frontpage', $langCode, $path);
    }
    else {
      $path = \variable_get('site_frontpage', $path);
    }
  }
  return ($router_item = \menu_get_item($path)) && $router_item['access'];
}