namespacing for custom field type module

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • micha-nerdlichter
    Junior Member
    • Sep 2017
    • 8

    namespacing for custom field type module

    I created a plugin "Foo" to define a custom field type "time". In my files/client/modules/foo/src/views/fields/time.js I have defined the view with a namespace prefix foo::
    Code:
    Espo.define('[COLOR=#FF0000]foo:[/COLOR]views/fields/time', 'views/fields/base', function (Dep) {
      return Dep.extend({
        type: 'int',
        editTemplate: 'foo:fields/time/edit',
        ...
    I can create a field of this type in an entity and add it to my layout. But as soon as I want to create a new instance of my entity type, ESPO stops with a js error because it tries to load view views/fields/time instead of foo:views/fields/time. So it looks for the file in client/src/views/... instead of client/modules/foo/src/views/... Why is the prefix lost?

    The strange thing is: the field-manager view in client/modules/foo/src/views/admin/field-manager/fields/time/default.js is loaded correctly.

    As soon as I copy all my files directly to the core-paths, everything works fine. But doesn't this whole module-mechanism and the prefixing exist to prevent that? Were there any changes in the module loading mechanism? The extension https://github.com/ayman-alkom/EspoDataGrid shows the same errors in 4.8.1.
  • tarasm
    Super Moderator
    • Mar 2014
    • 573

    #2
    Did you define this field in metadata?
    Job Offers and Requests

    Comment

    • micha-nerdlichter
      Junior Member
      • Sep 2017
      • 8

      #3
      I did, yes. I figured it out... explanation in https://github.com/espocrm/espocrm/issues/647

      Thanks anyway

      Comment

      Working...