Project

General

Profile

Actions

Feature #71247

closed

Add (Flash)Message after extension update with inline html

Added by Simon Schaufelberger over 8 years ago. Updated about 6 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Extension Manager
Target version:
-
Start date:
2015-11-02
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

I have written my own slot for the extension manager after installation of an extension like this:

ext_localconf.php

/** @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher */
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
$signalSlotDispatcher->connect(
    'TYPO3\CMS\Extensionmanager\Utility\InstallUtility',
    'afterExtensionInstall',
    'Vendor\Website\Utility\InstallUtility',
    'addFlashMessageAfterExtensionInstall'
);

ext:website/Classes/Utility/InstallUtility.php

<?php
namespace Vendor\Website\Utility;

use TYPO3\CMS\Core\Messaging\AbstractMessage;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
 * Extension Manager Install Utility
 */
class InstallUtility implements SingletonInterface {

    /**
     * @var FlashMessageService
     */
    protected $flashMessageService;

    /**
     * @param FlashMessageService $flashMessageService
     */
    public function injectFlashMessageService(FlashMessageService $flashMessageService) {
        $this->flashMessageService = $flashMessageService;
    }

    /**
     * @param $extensionKey
     * @throws \TYPO3\CMS\Core\Exception
     */
    public function addFlashMessageAfterExtensionInstall($extensionKey) {
        $flashMessageQueue = $this->flashMessageService->getMessageQueueByIdentifier('extbase.flashmessages.tx_extensionmanager_tools_extensionmanagerextensionmanager');

        $messageBody = 'extension installed: '.$extensionKey;

        /* @var FlashMessage $flashMessage */
        $flashMessage = GeneralUtility::makeInstance(
            FlashMessage::class, $messageBody, '', AbstractMessage::OK, TRUE
        );
        $flashMessageQueue->enqueue($flashMessage);
    }
}

I would love to add some HTML in the $messageBody but that gets htmlspechialchared.

Inspired by sgalinski's TypoScript Plugin for PhpStorm it would like so show an message like this:

Thank you for using xxx plugin from xxx

You are using version 1.x now.

You can get the latest information about this release on our website(link).
If you think you found a bug, please report it in our issue tracker(link).
Also don't hesitate to inform us about new feature wishes(link).

I would like to add a screenshot from phpstorm but I can't. Once the message is hidden, you cannot show it anymore even with down- and upgrade.

Possible solution
Fetch information from TER (sponsor links, documentation link, issue tracker) or make it possible to set it in an extension somehow maybe in ext_emconf.php


Files

typoscript plugin.png (32.6 KB) typoscript plugin.png Simon Schaufelberger, 2016-02-22 10:58
Actions #1

Updated by Mathias Schreiber over 8 years ago

  • Status changed from New to Needs Feedback
  • Assignee set to Mathias Schreiber

We denied markup in FlashMessages on purpose.
The reasoning is that a flashmesage can also be shown from a context different from a webbrowser (think CLI for example).
Thus, markup in a flashmessage must not be used.

Actions #2

Updated by Benni Mack over 8 years ago

  • Status changed from Needs Feedback to Rejected
  • Assignee deleted (Mathias Schreiber)

Agreed. If necessary, should be implemented manually with a separate hook in the output, and not via flash messages.

Actions #3

Updated by Simon Schaufelberger over 8 years ago

Should I create a new ticket for the hook/signal/... to be implemented?

Actions #4

Updated by Benni Mack over 8 years ago

yes please :)

Actions #6

Updated by Simon Schaufelberger about 6 years ago

  • Description updated (diff)
Actions

Also available in: Atom PDF