Solved How can I override templates?
-
I see how to override some text with translations, but I need to insert some HTML tags into those translations. So, I am wondering how I can override templates so that I can update them to the needs for my system.
For example - on the login page, there is the message "If you have ever contacted us previously, your account is more than likely already created". Users that have created an account via the ticket, however, cannot log in since they do not have a password. I would like to add some tags for emphasis and possibly link to help customers understand how to complete setting up their account by setting a password. I know the file is here (https://github.com/uvdesk/support-center-bundle/blob/master/Resources/views/Knowledgebase/login.html.twig) but I need some way to override this so that I can customize the login page per the needs of my application.
I see that in some other tickets (https://forums.uvdesk.com/topic/1876/how-to-change-logo-for-admin-agent-login-page-and-dashboard/2) and (https://forums.uvdesk.com/topic/1902/knowledgebase-text-colour/2) you've told other users to edit the files in their /vendor/ directory. There has to be some other way to do this, right? Generally speaking aren't the files in your vendor directory not supposed to be edited? If you edit them, aren't you at risk of losing your customizations when you run composer updates?
-
Found the answer to my own question. Either Symfony's documentation is a bit wrong or UVdesk application isn't using the normal methods per Symfony's documentation.
I was attempting to use Symfony's instructions here (https://symfony.com/doc/current/bundles/override.html) but it did not work. I was trying to override the login template with a file in 'templates/bundles/UVDeskSupportCenter/Knowledgebase/login.html.twig'. This did not work. I was able to find this semi-related issue in GitHub (https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/issues/557) that got me on the right track.
Using "bin/console debug:twig" I was able to find the correct path which is "templates/bundles/UVDeskSupportCenterBundle"/Knowledgebase/login.html.twig". You need to add that 'Bundle' onto the end of the end of the bundle name as it exists here (https://github.com/uvdesk/support-center-bundle/blob/master/Controller/Customer.php#L102).