Announcement

Collapse
No announcement yet.

Is ti possible to override views in an upgrade-safe way?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is ti possible to override views in an upgrade-safe way?

    The title pretty much sumarizes my question. Can I somehow override view or do I have to directy edit view's source code? I tried creating view with same path in client/custom folder, but it didn't work.

  • #2
    Yes, Espo is designed to be customized very easily.

    The reason why your implementation did not work is possibly that you didn't create a custom clientDefs metadata file for the entity and specified there that your custom view should be used to render the entity.

    For front-end changes you use the namespace client/custom/.....
    For back-end changes and metadata files you use the namespace custom/Espo/Custom/...

    To implement a custom view class you need to do three things:

    1) Create the custom view class (override view).

    2) Create a custom "clientDefs" metadata file that will tell Espo to apply your custom view class instead of the standard view. Each entity has it's clientDefs metadata file and Espo uses this file to determine which scripts use for front-end operations.

    3) Clear cache and rebuild Espo to implement the changes

    Here are some links that might help

    https://docs.espocrm.com/development/custom-views/

    https://forum.espocrm.com/forum/deve...ange-something

    https://forum.espocrm.com/forum/deve...-s-detail-view

    Comment


    • mozkomor
      mozkomor commented
      Editing a comment
      I created custom entityDef instead of clientDef. Thank you, your solution works.

  • #3
    You can also create your own modules, it's great because if you create many modifications you'll have issues with managing them.
    If you create modules, you'll be able to seperate modifications. When i've started using of EspoCRM almost 4 years ago, i've adjusted EspoCRM to needs of my company and now i have everything mixed there. And i'll spent maaaaaaany days to seperate these changes to modules </3

    If you don't now how to create modules in client, you can look at our extension: https://github.com/dubas-pro/ext-dar...client/modules

    Comment


    • item
      item commented
      Editing a comment
      @telecastg,
      let me understand with my sample
      i have create ParyolItems and Payroll entity..
      i have coded many ... with that there is too new jobs and client files (your help)..
      All 2 entity have many relation to out-of-box or another entity...

      How do you make a extension with this ?
      just copy file and make a zip ?
      rebuild will do the rest (relation with contact, or ... other entity) ?

      Regards

    • telecastg
      telecastg commented
      Editing a comment
      One excellent way to see how this works is to download the free extension Real Estate and see how it is structured.

      Each extension has 2 major folders ("files" and "scrips") and a json file called "manifest.json"

      The folder "files" contains all your module files, structured just like Espo, and the folder "scripts" contains php scripts (optional) that are to be executed after installation and after uninstallation. The scripts make things possible like insert menu options that only used for the module, etc.

      To prepare the extension for packaging once all files have been created, edit the "manifest" to specify a version number and the minimum version of Espo required to use the extension, then compress the "files" folder, the "scripts" folder (if any scripts were created here) and the "manifest".

      In admin mode, you can now upload the compressed extension and install.

      Note: if you are substituting "Custom" files with your extension, make sure that you delete those "duplicated" files because otherwise Espo will always give priority to "Custom" over any "Module"
      Last edited by telecastg; 02-23-2021, 05:11 PM.

    • item
      item commented
      Editing a comment
      Hello @telecastg
      i have respond here : https://forum.espocrm.com/forum/gene...7904#post67904

      we need begin "petit" .. real-esteate is big complex extension

      Regards

  • #4
    item modules are more hmm clean? You can look at all modules and open only one which you need right now.
    Vendor library? You mean composer?

    Comment


    • #5
      Yes, via composer ... sample https://github.com/thephpleague/flysystem

      so i make extension of all vendor library i use.. so no need composer to install

      Comment


      • emillod
        emillod commented
        Editing a comment
        I'll try to prepare some example for you, but not today, because i'm still working on paypal integration, and it's already annoying me because it's taking too much time

      • item
        item commented
        Editing a comment
        @emillod,
        not urgent .. is for community..
        i have post about a basic sample for extension to telecastg.. see above comment from me
        after we can go more complexe

    • #6
      And what about overriding entity's field view? I tried changing entityDefs and setting custom view for the field, but it didn't work.

      EDIT: My problem was, that field was being added as bottomPanel in clientDefs. I tried changing it and it worked just as it should. Thanks everyone for help.
      Last edited by mozkomor; 02-22-2021, 11:14 AM.

      Comment


      • #7
        Just in case anyone is interested on how to use modules and create installable extensions, you can check these posts: https://forum.espocrm.com/forum/deve...able-extension and https://forum.espocrm.com/forum/deve...a-custom-field
        Last edited by telecastg; 02-23-2021, 01:17 AM.

        Comment

        Working...
        X