You are here

public static function SiteimproveUtils::setSessionUrl in Siteimprove 7

Save URL in session.

Parameters

object $entity: Node or taxonomy term entity object.

string $id: Name of identifier field:

  • nid: Node id.
  • tid: Taxonomy term id.

string $path: Internal path of entity:

  • node/: Node path.
  • taxonomy/term/: Taxonomy term path.
4 calls to SiteimproveUtils::setSessionUrl()
siteimprove_node_insert in ./siteimprove.module
Implements hook_node_insert().
siteimprove_node_update in ./siteimprove.module
Implements hook_node_update().
siteimprove_taxonomy_term_insert in ./siteimprove.module
Implements hook_taxonomy_term_insert().
siteimprove_taxonomy_term_update in ./siteimprove.module
Implements hook_taxonomy_term_update().

File

includes/SiteimproveUtils.php, line 88
Utils for Siteimprove Plugin.

Class

SiteimproveUtils
Class SiteimproveUtils.

Code

public static function setSessionUrl($entity, $id, $path) {

  // Check if user has access.
  if (user_access(SITEIMPROVE_PERMISSION_USE)) {

    // Get friendly url of node and save in SESSION.
    $url = url($path . $entity->{$id}, array(
      'absolute' => TRUE,
    ));
    $url = SiteimproveUtils::rewriteDomain($url);
    $_SESSION['siteimprove_url'][] = $url;
  }
}