You are here

class AuthcacheBlockFragment in Authenticated User Page Caching (Authcache) 7.2

Fragment handler for blocks.

Hierarchy

Expanded class hierarchy of AuthcacheBlockFragment

See also

block.module

1 string reference to 'AuthcacheBlockFragment'
authcache_block_authcache_p13n_fragment in modules/authcache_block/authcache_block.module
Implements hook_authcache_p13n_fragment().

File

modules/authcache_block/includes/AuthcacheBlockFragment.inc, line 12
Defines fragment for blocks.

View source
class AuthcacheBlockFragment implements AuthcacheP13nFragmentInterface, AuthcacheP13nFragmentLoaderInterface {
  protected $blockId;
  protected $module;
  protected $delta;

  /**
   * Construct new personalized block fragment.
   */
  public function __construct($block_id, $module, $delta) {
    $this->blockId = $block_id;
    $this->module = $module;
    $this->delta = $delta;
  }

  /**
   * {@inheritdoc}
   */
  public function load($keys, $context) {
    $block = block_load($this->module, $this->delta);
    if (!$block) {
      throw new AuthcacheP13nRequestNotFound();
    }
    return array(
      $this->blockId => $block,
    );
  }

  /**
   * {@inheritdoc}
   */
  public function render($block_id, $block, $context) {
    $build = _block_get_renderable_array(_block_render_blocks(array(
      $block_id => $block,
    )));
    return render($build);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AuthcacheBlockFragment::$blockId protected property
AuthcacheBlockFragment::$delta protected property
AuthcacheBlockFragment::$module protected property
AuthcacheBlockFragment::load public function Load the objects designated by the given list of keys. Overrides AuthcacheP13nFragmentLoaderInterface::load
AuthcacheBlockFragment::render public function Render and return fragment. Overrides AuthcacheP13nFragmentInterface::render
AuthcacheBlockFragment::__construct public function Construct new personalized block fragment.