How to override vendor/elgg/elgg/js/lib/ui.js

Elgg 2.3.13

In my plugin I need to to override vendor/elgg/elgg/js/lib/ui.js 

How to do it

Thank you

  • Copy this file from:

    vendor\elgg\elgg\views\default\elgg.js.php

    To your custom plugin:

    \mod\my_plugin\views\default\elgg.js.php

    Comment this:

    $elggDir->getPath("js/lib/ui.js"),

    Add after:

    foreach ($files as $file) {
       readfile($file);
       // putting a new line between the files to address https://github.com/elgg/elgg/issues/3081
       echo "\n";
    }
    

    Path to your custom ui.js (e.g. \mod\my_plugin\views\default\lib\ui.js):

    readfile(dirname(__FILE__). '/lib/ui.js');
    echo "\n";

    Clean the caches.

    Done.

  • Works great.

    Thank you very much dear RVR