How do I use the '/custom' folders?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tothewine
    Active Community Member
    • Jan 2018
    • 373

    How do I use the '/custom' folders?

    Hello, I am looking for information. Is there some documentation page about the "custom files" mechanism?
    How do the '/custom' and '/client/custom' folders works? Can I patch any file?

    What is the procedure if I want to add (or replace) a file in '/client/css' and parsist it across upgrades?

    My specific usage case is a css file that needs to be made available in '/client/css/espo/mystyle.css' because it extends the base espo theme and imports many css files.

    Update: I think I am going to make an extension that installs the files. Is there a more comprhensive documentation page than https://www.espocrm.com/documentatio...sion-packages/ ?

    For example what happens if I replace core files? Are they backupped during installation and restored when the extension is uninstalled?
    What if the user upgrades the espo-crm instance while my extension replaced some files?

    Is it safe to create a folder in the index directory or the upgrade process would delete it ?
    Last edited by tothewine; 10-10-2018, 04:12 PM.
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello,
    read these https://github.com/espocrm/documenta...rces.md#themes
    Note: It's possible to create custom entity through Admin UI. This article is outdated. I'm going to show you how to create new entities in EspoCRM manually. We will make new simple module called PM (Project Management) with Projects and Tasks entities.


    you can override in custom/Espo/Custom almost all from application/Espo with the saving next path, except Core folder
    but if it is a class, the namespace has to start from Espo\Custom\.....{path, aftercustom/Espo/Custom}



    For your need is better to develop your own theme and use it as default. This way is upgrade safe

    Comment


    • concept
      concept commented
      Editing a comment
      hello, if you can not customize Espo\Core in custom\Espo\Custom, where can I do it?
      Thanks
  • tothewine
    Active Community Member
    • Jan 2018
    • 373

    #3
    Thanks for the information! I have solved the issue about the theme.

    Now regarding overriding PHP files.. So if I want to modify "espocrm-5.4.4\application\Espo\Modules\Crm\Services\Accoun t.php" I have to make a copy of it to "espocrm-5.4.4\custom\Espo\Custom\Modules\Crm\Services\Acco unt.php" and change the namespace like this ?

    Originally posted by original
    namespace Espo\Modules\Crm\Services;
    use \Espo\ORM\Entity;
    class Account extends \Espo\Services\Record {
    Originally posted by modified
    namespace Espo\Custom\Modules\Crm\Services;
    use \Espo\ORM\Entity;
    class Account extends \Espo\Services\Record {
    Last edited by tothewine; 10-16-2018, 10:45 PM.

    Comment

    • tanya
      Senior Member
      • Jun 2014
      • 4308

      #4
      if you want to modify "espocrm-5.4.4\application\Espo\Modules\Crm\Services\Accoun t.php" you have to create a file "espocrm-5.4.4\custom\Espo\Custom\Services\Account.php" with the content
      Code:
      <?php
      
      namespace Espo\Custom\Services;
      
      class Account extends \Espo\Modules\Crm\Services\Account
      {
      //this class extends  all the methods of \Espo\Modules\Crm\Services\Account, so you can just add new ones or override needed
      }
      And don't forget to Clear Cache in Administration

      Comment

      • tothewine
        Active Community Member
        • Jan 2018
        • 373

        #5
        Thanks! I was able to do that.

        In the case of "espocrm-5.4.4\client\src\views\fields\base.js" is there a way to override it or I have to do a direct modification ?
        Last edited by tothewine; 10-17-2018, 03:02 PM.

        Comment

        • tanya
          Senior Member
          • Jun 2014
          • 4308

          #6
          you can override view for each field type,but not base.js
          The single street address field provided by default is not adequate for our addressing needs so I'm looking to add a second street address field. It's easy

          Comment

          Working...