public function Trigger::execute in Build Hooks 8
return void
Overrides TriggerInterface::execute
2 calls to Trigger::execute()
- Trigger::executeCron in src/
Trigger.php - return void
- Trigger::executeNode in src/
Trigger.php
File
- src/
Trigger.php, line 79
Class
- Trigger
- Class Trigger.
Namespace
Drupal\build_hooksCode
public function execute() {
if (!$this
->isValidUser()) {
$message = $this->stringTranslation
->translate('Insufficient user acess', []);
$this->logger
->get('build_hooks')
->error($message);
return FALSE;
}
try {
$hook = $this->configFactory
->get('build_hooks.settings')
->get('build_hook');
$this->httpClient
->post($hook . '-lorem');
$message = 'Build Hook Executed';
$this
->processMessage($message);
$this
->processLog($message);
} catch (RequestException $exception) {
$message = $this->stringTranslation
->translate('Build Hook execute error: "%error"', [
'%error' => $exception
->getMessage(),
]);
$this->messenger
->addError($message);
$this->logger
->get('build_hooks')
->error($message);
return FALSE;
}
return TRUE;
}