You are here

abstract class AbstractBaseController in Render cache 7.2

Controller abstract base class.

Hierarchy

Expanded class hierarchy of AbstractBaseController

File

src/RenderCache/Controller/AbstractBaseController.php, line 16
Contains \Drupal\render_cache\RenderCache\Controller\AbstractBaseController

Namespace

Drupal\render_cache\RenderCache\Controller
View source
abstract class AbstractBaseController extends PluginBase implements ControllerInterface {

  // -----------------------------------------------------------------------
  // Suggested implementation functions.

  /**
   * @param array $default_cache_info
   * @param array $context
   *
   * @return bool
   */
  protected abstract function isCacheable(array $default_cache_info, array $context);

  /**
   * Provides the cache info for all objects based on the context.
   *
   * @param array $context
   *
   * @return array
   */
  protected abstract function getDefaultCacheInfo($context);

  /**
   * @param object $object
   * @param array $context
   *
   * @return array
   */
  protected abstract function getCacheContext($object, array $context);

  /**
   * Specific cache info overrides based on the $object.
   *
   * @param object $object
   * @param array $context
   *
   * @return array
   */
  protected abstract function getCacheInfo($object, array $context);

  /**
   * @param object $object
   * @param array $context
   *
   * @return array
   */
  protected abstract function getCacheKeys($object, array $context);

  /**
   * @param object $object
   * @param array $context
   *
   * @return array
   */
  protected abstract function getCacheHash($object, array $context);

  /**
   * @param object $object
   * @param array $context
   *
   * @return array
   */
  protected abstract function getCacheTags($object, array $context);

  /**
   * @param object $object
   * @param array $context
   *
   * @return array
   */
  protected abstract function getCacheValidate($object, array $context);

  /**
   * Render uncached objects.
   *
   * This function needs to be implemented by every child class.
   *
   * @param array $objects
   *   Array of $objects to be rendered keyed by id.
   *
   * @return array
   *   Render array keyed by id.
   */
  protected abstract function render(array $objects);

  /**
   * Renders uncached objects in a recursion compatible way.
   *
   * The default implementation is dumb and expensive performance wise, as
   * it calls the render() method for each object seperately.
   *
   * Controllers that support recursions should implement the
   * RecursionControllerInterface and subclass from
   * BaseRecursionController.
   *
   * @see \Drupal\render_cache\RenderCache\Controller\RecursionControllerInterface
   * @see \Drupal\render_cache\RenderCache\Controller\BaseRecursionController
   *
   * @param object[] $objects
   *   Array of $objects to be rendered keyed by id.
   *
   * @return array[]
   *   Render array keyed by id.
   */
  protected abstract function renderRecursive(array $objects);

  // -----------------------------------------------------------------------
  // Helper functions.

  /**
   * Provides the fully pouplated cache information for a specific object.
   *
   * @param object $object
   * @param array $cache_info
   * @param array $context
   *
   * @return array
   */
  protected abstract function getCacheIdInfo($object, array $cache_info = array(), array $context = array());

  /**
   * @param string $type
   * @param array $data
   * @param mixed|null $context1
   * @param mixed|null $context2
   * @param mixed|null $context3
   */
  protected abstract function alter($type, &$data, &$context1 = NULL, &$context2 = NULL, &$context3 = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractBaseController::alter abstract protected function 1
AbstractBaseController::getCacheContext abstract protected function 1
AbstractBaseController::getCacheHash abstract protected function 1
AbstractBaseController::getCacheIdInfo abstract protected function Provides the fully pouplated cache information for a specific object. 1
AbstractBaseController::getCacheInfo abstract protected function Specific cache info overrides based on the $object. 1
AbstractBaseController::getCacheKeys abstract protected function 1
AbstractBaseController::getCacheTags abstract protected function 1
AbstractBaseController::getCacheValidate abstract protected function 1
AbstractBaseController::getDefaultCacheInfo abstract protected function Provides the cache info for all objects based on the context. 1
AbstractBaseController::isCacheable abstract protected function 1
AbstractBaseController::render abstract protected function Render uncached objects. 3
AbstractBaseController::renderRecursive abstract protected function Renders uncached objects in a recursion compatible way. 1
ControllerInterface::getContext public function 1
ControllerInterface::renderPlaceholders public static function 1
ControllerInterface::setContext public function 1
ControllerInterface::view public function 1
ControllerInterface::viewPlaceholders public function 1