[Vtigercrm-developers] Creating a custom UIType?

Alan Lord alanslists at gmail.com
Mon Jun 22 14:17:28 GMT 2020

Sure - I understand that. But that means I have to edit/change core 
vtiger code.

I already have a Vtiger_Canvas_UIType class which is effectively 
standalone... I was making the point that this particular method 
(isAjaxEditable) seems to me to belong in the UIType model not in the 
general Field Model because it is not possible to extend it unless you 
know the specific *module* and a particular Module should not really 
have anything to do with a Field's structure or attributes - surely?


On 22/06/2020 15:10, nilay khatri wrote:
> You can do this in the Vtiger_Field_Model class under the isAjaxEditable 
> fn. by adding conditions for the UIType.
> If for a specific module, extend the Vtiger_Field_Model in your module 
> and restrict from there.
> On Mon, Jun 22, 2020 at 6:58 PM Alan Lord <alanslists at gmail.com 
> <mailto:alanslists at gmail.com>> wrote:
>     Following up a bit on this, I'd like to make my new custom field
>     read-only in Detail View, i.e. disable Ajax Editing.
>     However the method isAjaxEditable() exists in the Vtiger_Field_Model
>     (even though it mostly tests for UITypes), not in the UIType_Model
>     which
>     seems a bit odd to me and I can't see an easy way to extend/override
>     the
>     Field_Model class?
>     I can do it from the client-side fairly easily but this method just
>     seems to be in the wrong class to me - by being in the Field_Model it's
>     suggesting that the function is dependent on the current *Module*, not
>     the current Field...?
>     Cheers
>     Al
>     On 22/06/2020 11:40, Alan Lord 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?
>     _______________________________________________
>     http://www.vtiger.com/
> _______________________________________________
> http://www.vtiger.com/

More information about the vtigercrm-developers mailing list