You are here

redirect_domain.module in Redirect 8

File

modules/redirect_domain/redirect_domain.module
View source
<?php

use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;

/**
* Implements hook_help().
*/
function redirect_domain_help($route_name, RouteMatchInterface $route_match) {
  $output = '';
  switch ($route_name) {
    case 'help.page.redirect_domain':
      $output = '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The Redirect domain module allows users to redirect between domains.') . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dt>' . t('Manage domain redirects') . '</dt>';
      $output .= '<dd>' . t('The domain redirect is accessed through <a href=":domainlist">Domain Redirects</a>. The user can add the domain redirects through the domain redirect table which consists of the domain from which it needs to be redirected, the sub path and the complete url destination to which it needs to be redirected. The module also supports the usage of a wildcard redirecting, thus many requests can be handled with one instance of domain redirect.', [
        ':domainlist' => Url::fromRoute('redirect_domain.domain_list')
          ->toString(),
      ]) . '</dd>';
      return $output;
    case 'redirect_domain.domain_list':
      $output = '<p>' . t('The domain redirect table consists of the domain from which it needs to be redirected, the sub path and the complete url destination to which it needs to be redirected.') . '</p>';
      $output .= '<h5>' . t('Example Configuration') . '</h5>';
      $output .= '<ul>';
      $output .= '<li> example.com/redirect => redirected.com/example-path </li>';
      $output .= '<li> foo.com/* => bar.com </li>';
      $output .= '</ul>';
      $output .= '<h5>' . t('Example Redirects') . '</h5>';
      $output .= '<ul>';
      $output .= '<li>' . t('Request: example.com/redirect => Response: redirected.com/example-path') . '</li>';
      $output .= '<li>' . t('Request: foo.com/any-path => Response: bar.com') . '</li>';
      $output .= '</ul>';
      $output .= '<h5>' . t('Precedence') . '</h5>';
      $output .= t('Top-down precedence is used. This means the first matching redirect that is found will be taken. For example, assume these redirect rules:') . '</p>';
      $output .= '<ul>';
      $output .= '<li>' . t('foo.com/some/path => somedomain.com/path') . '</li>';
      $output .= '<li>' . t('foo.com/* => wildcardredirect.com') . '</li>';
      $output .= '<li>' . t('foo.com/other/path => otherdomain.com/path') . '</li>';
      $output .= '</ul>';
      $output .= '<p>' . t('The following redirects would actually occur:') . '</p>';
      $output .= '<ul>';
      $output .= '<li>' . t('foo.com/some/path => somedomain.com/path') . '</li>';
      $output .= '<li>' . t('foo.com/other/path => wildcardredirect.com') . '</li>';
      $output .= '</ul>';
      return $output;
  }
}

Functions

Namesort descending Description
redirect_domain_help Implements hook_help().