Custom modifications to xibo-cms/lib/Controller/

Hi, I would like to thank the team for the awesome work at xibo.

I have installed xibo via docker and would like to make some custom modifications. For the twig files, i am able to make the changes by adding ‘view_path’ => PROJECT_ROOT . ‘/web/theme/custom/mytheme/views’, to config.php.

Now I would like to make some changes to xibo-cms/lib/Controller/display.php.
How am i able to do that?


I guess you mean in your custom theme folder? If so, then great!

That is core code - so you cannot (maybe shouldn’t) make changes in there. If you absolutely must make changes in there, then i’d recommend forking the project and running from the develop branch.

It is likely that your requirement can either be addressed as a bug in the project, in which case we can fix it in there, or apply your patch. Or your requirement is adding extra functionality? Have you seen these docs.

If you let me know what you want to do, I should be able to comment with more accuracy.

Hey Dan,

Thanks for the prompt reply.

My intention is to add extra functionality and also to remove the “delete” menu from “display.php”. - I would like to let my team have access to the menu but wouldn’t want them to delete it by accident as it would cause us lots of hassle.

I was able to edit it when I install “Xibo” manually, but since i’ve installed it via docker now. I would like to see if it’s still possible.

Thank you.

Adding extra functionality it best achieved by creating your own custom middleware/controller to take those actions - injecting Xibo dependencies as needed.

Removing the delete button can be done purely with the permissions model, without editing code (i.e. don’t give any other accounts delete permissions).

If you must edit the core file directly, you can take a copy of that file from the repository, make your changes and then map it into the docker container as a volume. You’d add it to the cms-web service volumes:

 - <path to edited file>:/var/www/cms/<path to source file>

If you then rerun docker-compose up -d your file will be mapped into the container replacing the existing file.

Got it! Thanks for the awesome assistance.
Have a great day!

Hi dan,

Need your assistance to elaborate on "mapping it into the docker container as a volume. You’d add it to the cms-web service volumes.

Example; If I have edited the Display.php.
Do I place it under the /opt/xibo/shared/cms/web/theme/custom/customtheme/controller ?

And where do I place the mapping code?
cms/web/theme/custom/customtheme/controller/display.php : /var/www/cms/lib/Controller/Display.php

You place the modified file whereever you wish. I wouldn’t suggest your theme folder. I’d make a directory somewhere else inside shared.

Your volume mapping goes in the docker-compose.yml file you’re using.

So if for example you made a folder shared/cms/mods, you’d change your docker-compose.yml file to add an additional line to the volumes section:

    image: xibosignage/xibo-cms:release_1.8.2
        - "./shared/cms/custom:/var/www/cms/custom"
        - "./shared/backup:/var/www/backup"
        - "./shared/cms/web/theme/custom:/var/www/cms/web/theme/custom"
        - "./shared/cms/library:/var/www/cms/library"
        - "./shared/cms/web/userscripts:/var/www/cms/web/userscripts"
        - "./shared/cms/mods/Controller/Display.php:/var/www/cms/lib/Controller/Display.php"

Then down/up the containers to have that applied.

Hi Alex,

I have created the file shared/cms/mods/Controller/Display.php

Added the line - "./shared/cms/mods/Controller/Display.php:/var/www/cms/lib/Controller/Display.php to docker-compose.yml

I received this when applying docker-compose down.

ERROR: yaml.parser.ParserError: while parsing a block collection
in “./docker-compose.yml”, line 25, column 13
expected , but found ''
in “./docker-compose.yml”, line 39, column 16

It’s missing a closing " mark. I’ve updated my example.

Working great now!

Thanks Alex.