diff --git a/library/Director/Objects/IcingaCommand.php b/library/Director/Objects/IcingaCommand.php index aefb8c3c..0ae9e9b7 100644 --- a/library/Director/Objects/IcingaCommand.php +++ b/library/Director/Objects/IcingaCommand.php @@ -58,18 +58,27 @@ class IcingaCommand extends IcingaObject protected function renderObjectHeader() { - if ($this->getResolvedProperty('methods_execute') === 'PluginNotification') { - return sprintf( - "%s %s %s {\n", - $this->getObjectTypeName(), - 'NotificationCommand', - c::renderString($this->getObjectName()) - ); + $execute = $this->getResolvedProperty('methods_execute'); + + if ($execute === 'PluginNotification') { + return $this->renderObjectHeaderWithType('NotificationCommand'); + } elseif ($execute === 'PluginEvent') { + return $this->renderObjectHeaderWithType('EventCommand'); } else { return parent::renderObjectHeader(); } } + protected function renderObjectHeaderWithType($type) + { + return sprintf( + "%s %s %s {\n", + $this->getObjectTypeName(), + $type, + c::renderString($this->getObjectName()) + ); + } + public function mungeCommand($value) { if (is_array($value)) {