You are here

function varnish_image_purge_help in Varnish purger 8.2

Same name and namespace in other branches
  1. 8 modules/varnish_image_purge/varnish_image_purge.module \varnish_image_purge_help()

Implements hook_help().

File

modules/varnish_image_purge/varnish_image_purge.module, line 20
Contains varnish_image_purge.module.

Code

function varnish_image_purge_help($route_name, RouteMatchInterface $route_match) {
  $admin_link_text = t('administer Varnish image purge');
  $admin_link_link = Link::createFromRoute($admin_link_text, 'varnish_image_purge.configuration');
  $output_admin_link = $admin_link_link
    ->toString()
    ->getGeneratedLink();
  switch ($route_name) {
    case 'help.page.varnish_image_purge':
      $output = '';
      $output .= '<h2>' . t('About') . '</h2>';
      $output .= '<p>' . t('Purge image styles after entity update') . '</p>';
      $output .= '<p>' . t('You need to setup Varnish to listen to the request method URIBAN. Example:') . '</p>';
      $output .= '<pre><code>if (req.method == "URIBAN") {<br />';
      $output .= '  ban("req.http.host == " + req.http.host + " && req.url == " + req.url);<br />';
      $output .= '  # Throw a synthetic page so the request won\'t go to the backend.<br />';
      $output .= '  return (synth(200, "Ban added."));<br />';
      $output .= '}</code></pre>';
      $output .= '<h2>' . t('Adminster') . '</h2>';
      $output .= '<p>' . t('By default every image belonging to any entity is purged.');
      $output .= t('To specify which entities that should have image purged on edit, go to @output_admin_link', [
        '@output_admin_link' => $output_admin_link,
      ]);
      $output .= '</p>';
      return $output;
    default:
  }
}