class BanHooks
Hook implementations for ban.
Hierarchy
- class \Drupal\ban\Hook\BanHooks uses \Drupal\Core\StringTranslation\StringTranslationTrait
Expanded class hierarchy of BanHooks
File
-
core/
modules/ ban/ src/ Hook/ BanHooks.php, line 13
Namespace
Drupal\ban\HookView source
class BanHooks {
use StringTranslationTrait;
/**
* Implements hook_help().
*/
public function help($route_name, RouteMatchInterface $route_match) : ?string {
switch ($route_name) {
case 'help.page.ban':
$output = '';
$output .= '<h2>' . $this->t('About') . '</h2>';
$output .= '<p>' . $this->t('The Ban module allows administrators to ban visits to their site from individual IP addresses. For more information, see the <a href=":url">online documentation for the Ban module</a>.', [
':url' => 'https://www.drupal.org/documentation/modules/ban',
]) . '</p>';
$output .= '<h2>' . $this->t('Uses') . '</h2>';
$output .= '<dl>';
$output .= '<dt>' . $this->t('Banning IP addresses') . '</dt>';
$output .= '<dd>' . $this->t('Administrators can enter IP addresses to ban on the <a href=":bans">IP address bans</a> page.', [
':bans' => Url::fromRoute('ban.admin_page')->toString(),
]) . '</dd>';
$output .= '</dl>';
return $output;
case 'ban.admin_page':
return '<p>' . $this->t('IP addresses listed here are banned from your site. Banned addresses are completely forbidden from accessing the site and instead see a brief message explaining the situation.') . '</p>';
}
return NULL;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
BanHooks::help | public | function | Implements hook_help(). | |
StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | 3 |
StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | |
StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | |
StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. | 1 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.