hook_block_cid_parts_alter
function hook_block_cid_parts_alter
hook_block_cid_parts_alter(&$cid_parts, $block)
Act on block cache ID (cid) parts before the cid is generated.
This hook allows you to add, remove or modify the custom keys used to generate a block cache ID (by default, these keys are set to the block module and delta). These keys will be combined with the standard ones provided by drupal_render_cid_parts() to generate the final block cache ID.
To change the cache granularity used by drupal_render_cid_parts(), this hook cannot be used; instead, set the 'cache' key in the block's definition in hook_block_info().
@params $cid_parts An array of elements used to build the cid.
Parameters
$block: The block object being acted on.
See also
Related topics
File
- modules/block/block.api.php, line 385
- Hooks provided by the Block module.
Code
function hook_block_cid_parts_alter(&$cid_parts, $block) { global $user; // This example shows how to cache a block based on the user's timezone. $cid_parts[] = $user->timezone; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!block!block.api.php/function/hook_block_cid_parts_alter/7.x