You are here

function widgets_build_cache_cid in Widgets 7

Parameters

$name:

string $scope:

array $context:

Return value

bool|string

4 calls to widgets_build_cache_cid()
theme_widgets_set_view in ./widgets.module
Returns HTML for a preview of an widget set.
widgets_element_delete_form_submit in ./widgets.admin.inc
Submit handler to delete an widget element.
widgets_set_form_add_submit in ./widgets.admin.inc
Submit handler for adding a new widget element to an widget set.
widgets_set_form_data_fields in ./widgets.admin.inc

File

./widgets.module, line 1276
Exposes global functionality for creating widget sets.

Code

function widgets_build_cache_cid($name, $scope = '', $context = array()) {
  $cache = FALSE;
  $cid = 'set:' . $name;
  if ($scope == 'site') {
    $cache = TRUE;
  }
  elseif ($scope == 'page') {
    $path = widgets_get_context_path($context);
    $cid .= ':page:' . $path;
    $cache = TRUE;
  }
  elseif ($scope == 'author') {
    $uid = widgets_get_context_author_uid($context);
    $cid .= ':author:' . $uid;
    $cache = TRUE;
  }
  elseif ($scope == 'user') {
    $uid = widgets_get_context_user_uid($context);
    $cid .= ':user:' . $uid;
    $cache = TRUE;
  }
  drupal_alter('widgets_cache_cid', $cid, $name, $scope, $context);
  if ($cache) {
    return $cid;
  }
  else {
    return FALSE;
  }
}