cache_review-1.0.x-dev/cache_review.module

cache_review.module
<?php

/**
 * @file
 * Hook implementations for the 'Cache review' module.
 */

use Drupal\Core\Link;
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function cache_review_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.cache_review':
      $link = Link::createFromRoute(t('Cache demonstration page'), 'cache_review.page')->toString();
      $help = '<h3>' . t('About') . '</h3>';
      $help .= '<p>' . t('Provides tools to help review and analyze how the internal (IPC for anonymous) and dynamic page cache (DPC for all users) work. The module also provide several demo pages with cached and non-cached items.') . '</p>';
      $help .= '<h3>' . t('Uses') . '</h3>';
      $help .= '<dl>';
      $help .= '<dt>' . t('Checking cache status') . '</dt>';
      $help .= '<dd>' . t('The status of cache is displaying at the bottom of page.') . '</dd>';
      $help .= '<dd>' . t('There you can find information about current auto-placeholder-conditions, current time, IPC and DPC status and meanings of cache marks on the page.') . '</dd>';
      $help .= '<dt>' . t('Playing with cache :)') . '</dt>';
      $help .= '<dd>' . t('There is an ability to test how the cache works with different pre-defined settings.') . '</dd>';
      $help .= '<dd>' . t('See the @link for reviewing and playing with different cache setting for elements on the pages.', ['@link' => $link]) . '</dd>';
      $help .= '<dd>' . t('There each cache mark (C, L, N) shows cache metadata of element on hover.') . '</dd>';
      $help .= '<dd>' . t('You can try to change cache settings (tags, contexts, max-age and lazy builder settings) in cache_review module sources.') . '</dd>';
      $help .= '<dd>' . t('Just refresh page and see the results. Also the time value on each elements will help to see if item is cached or not.') . '</dd>';
      $help .= '</dl>';
      return $help;

    default:
  }
}

/**
 * Implements hook_preprocess_HOOK() for HTML document templates.
 */
function cache_review_preprocess_html(&$variables) {
  $variables['#attached']['library'][] = 'cache_review/cache_review';
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc