public function BynderConfigHashGenerator::onChange in Bynder 8.3
Same name and namespace in other branches
- 8 src/EventSubscriber/BynderConfigHashGenerator.php \Drupal\bynder\EventSubscriber\BynderConfigHashGenerator::onChange()
- 8.2 src/EventSubscriber/BynderConfigHashGenerator.php \Drupal\bynder\EventSubscriber\BynderConfigHashGenerator::onChange()
- 4.0.x src/EventSubscriber/BynderConfigHashGenerator.php \Drupal\bynder\EventSubscriber\BynderConfigHashGenerator::onChange()
Generates hash based on active Bynder config and saves it into state.
Parameters
\Drupal\Core\Config\ConfigCrudEvent $event: The Event to process.
File
- src/
EventSubscriber/ BynderConfigHashGenerator.php, line 40
Class
- BynderConfigHashGenerator
- A subscriber that generates Bynder config hash.
Namespace
Drupal\bynder\EventSubscriberCode
public function onChange(ConfigCrudEvent $event) {
if (strpos($event
->getConfig()
->getName(), 'bynder.settings') === 0) {
$hash_source = [];
foreach ([
'consumer_key',
'consumer_secret',
'token',
'token_secret',
'account_domain',
] as $key) {
$hash_source[] = $event
->getConfig()
->get($key);
}
$this->state
->set('bynder_config_hash', md5(implode(':', $hash_source)));
}
}