class TokenCommands in Token 8
TokenCommands provides the Drush hook implementation for cache clears.
Hierarchy
- class \Drupal\token\Commands\TokenCommands extends \Drush\Commands\DrushCommands
Expanded class hierarchy of TokenCommands
1 string reference to 'TokenCommands'
1 service uses TokenCommands
File
- src/
Commands/ TokenCommands.php, line 11
Namespace
Drupal\token\CommandsView source
class TokenCommands extends DrushCommands {
/**
* The module_handler service.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* TokenCommands constructor.
*
* @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
* The module_handler service.
*/
public function __construct(ModuleHandlerInterface $moduleHandler) {
$this->moduleHandler = $moduleHandler;
}
/**
* Adds a cache clear option for tokens.
*
* @param array $types
* The Drush clear types to make available.
* @param bool $includeBootstrappedTypes
* Whether to include types only available in a bootstrapped Drupal or not.
*
* @hook on-event cache-clear
*/
public function cacheClear(array &$types, $includeBootstrappedTypes) {
if (!$includeBootstrappedTypes || !$this->moduleHandler
->moduleExists('token')) {
return;
}
$types['token'] = 'token_clear_cache';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TokenCommands:: |
protected | property | The module_handler service. | |
TokenCommands:: |
public | function | Adds a cache clear option for tokens. | |
TokenCommands:: |
public | function | TokenCommands constructor. |