1

I show a PNotify tooltip on mouseover element:

$(document).ready(function(){
    $('.element1').on('mouseover', '.element2', function(e) {
        if (PNotify.notices.length > 0) {
            PNotify.removeAll();
        }
        var tooltip = new PNotify({
            text: pin_text,
            ...

It works only if I'm logged in. The tooltip does not pop up and it throws an error: "Uncaught ReferenceError: PNotify is not defined" without being logged in. As soon as I login, it starts working without error.

Looks like PNotify in C5 is only available to logged in users by default. How can I use it in the view?

I tried changing

var tooltip = new PNotify({

to

tooltip = ConcreteAlert.notify({

Now it says "Uncaught ReferenceError: ConcreteAlert is not defined".

If I use the following in the controller:

$al = \Concrete\Core\Asset\AssetList::getInstance();
$al->register('javascript', 'pnotify', 'js/build/vendor/pnotify/pnotify.js');
$this->requireAsset('javascript', 'pnotify');

it screws all my css design and simply appends the hints at the bottom of the page.

linuxoid
  • 1,415
  • 3
  • 14
  • 32
  • I think the pnotify definition is either in the assetgroup 'core/app' and/or 'core/notification'. Try $this->requireAsset('core/app'); and $this->requireAsset('core/notification'); IMPORTANT : I do not know how this will impact css or other components on your website. – Jozzeh Jun 28 '18 at 08:51

0 Answers0