Show warning only if record not new

This commit is contained in:
Sebastian Meyer 2020-12-30 15:33:19 +01:00
parent 3eb0a5f78b
commit b19a469c24
1 changed files with 13 additions and 10 deletions

View File

@ -34,17 +34,20 @@ class EditInProductionWarning extends AbstractNode
*/
public function render(): array
{
// Load localization file.
$GLOBALS['LANG']->includeLLFile('EXT:dlf/Resources/Private/Language/FlashMessages.xml');
// Create flash message.
Helper::addMessage(
htmlspecialchars($GLOBALS['LANG']->getLL('flash.editInProductionWarning')),
htmlspecialchars($GLOBALS['LANG']->getLL('flash.attention')),
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING
);
// Add message to result array.
$result = $this->initializeResultArray();
$result['html'] = Helper::renderFlashMessages();
// Show warning only when editing existing records.
if ($this->data['command'] !== 'new') {
// Load localization file.
$GLOBALS['LANG']->includeLLFile('EXT:dlf/Resources/Private/Language/FlashMessages.xml');
// Create flash message.
Helper::addMessage(
htmlspecialchars($GLOBALS['LANG']->getLL('flash.editInProductionWarning')),
htmlspecialchars($GLOBALS['LANG']->getLL('flash.attention')),
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING
);
// Add message to result array.
$result['html'] = Helper::renderFlashMessages();
}
return $result;
}
}