[Vtigercrm-developers] Creating a custom UIType?

nilay khatri nilay.spartan at gmail.com
Mon Jun 22 12:42:28 GMT 2020


Subject line looks more like a general approach. If it is required to have
a full fledged custom UIType then the changes would need to be handled in
many places as mentioned.

If it is just a specific field for a few modules and is not required in
Reports, Listview search etc, then yes, just adding the Detail and Edit
view tpl, Field model for the UItype should do the job.

Adding the top level custom directory is a good idea, we are already using
this approach internally, and a step further actually. Have mentioned it at
code.vtiger.com.

On Mon, Jun 22, 2020 at 5:39 PM Alan Lord <alanslists at gmail.com> wrote:

> A canvas field could be useful for many things - I have a specific
> use-case here which I do not want to go into but the requirement may be
> applicable across multiple modules... I'm not sure that Reports will be
> an issue though - why would you want to report _anything_ about a canvas
> field?
>
> Anyway - creating a new UIType and registering it in the
> vtiger_ws_fieldtype table appears to be working. I've created a
> Canvas.php Field Model and a couple of tpl files for Detail and Edit views.
>
> It's a shame that all this can't be kept in a custom module though (or
> outside the standard module structures) - for now it will have to remain
> in the Vtiger module structure. Hence why I suggested adding a top-level
> "custom" directory to Vtiger [1]
>
>
> Al
>
> [1] https://code.vtiger.com/vtiger/vtigercrm/merge_requests/585#note_8739
>
>
> On 22/06/2020 12:52, nilay khatri wrote:
> > If it is for specific modules (and field) only then why not override the
> > behaviour of a near match/text type field in those modules?
> >
> > If it is about adding a UI type available in layout Editor as well, then
> > there is much to be done. Such as in Reports, CustomViews,
> > QueryGenerator etc..
> >
> > On Mon, Jun 22, 2020 at 4:12 PM Alan Lord <alanslists at gmail.com
> > <mailto:alanslists at gmail.com>> wrote:
> >
> >     I want to add a new UIType field to vtiger 7 that displays an html
> >     canvas element.
> >
> >     Am I right in thinking I should register it vtiger_ws_fieldtype and
> >     if I
> >     give it a fieldtype of "canvas" then I can extend the
> >     Vtiger_Field_Model
> >     to load it?
> >
> >     One thing I don't quite get is how in Detail Views the UIType
> template
> >     file does not seem to be used at all - it only seems to be called for
> >     Edit Views. So for Detail View do I need to modify the
> >     DetailViewBlockView.tpl for all/any modules where I might want to
> >     use my
> >     new field?
> >
> >     And in terms of choosing a UIType _number_ how do we prevent possible
> >     collisions? I can choose something like 995 or whatever, but
> presumably
> >     another developer could also choose the same number without knowing?
> >
> >
> >     Cheers
> >
> >
> >     Al
> >
> >     _______________________________________________
> >     http://www.vtiger.com/
> >
> >
> > _______________________________________________
> > http://www.vtiger.com/
> >
> _______________________________________________
> http://www.vtiger.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20200622/7a9c8a21/attachment.html>


More information about the vtigercrm-developers mailing list