Overriding Fabrik Model Files?

valandor062

New Member
Hello,

I am wondering if it's possible to override the Fabrik Model files located in the \components\com_fabrik\models folder and how I would go about doing this? If it's possible would I have to override from my main template file or the fabrik template file?

Thanks,
Valandor
 
Ah, that's a bit disappointing. I am needing to change the output of several things that are set within the models. There's a lot of useless code being output I really wanted to get rid of. Such as the size and maxlength attributes on my form element. While it's easy to create custom css to style the forms, it's impossible to change/remove unwanted attributes as they are all set within the models which can be seen if you run htmlentities in the default_group_labels_* on $element->element or in default.php template $this->elements['field']->element. I would presume that the element_raw should be the element without any styling attached to is such as the title_raw however this is always blank and really have no idea why it's there.

So I guess my major question would be how would I change,delete,add custom attributes so I can get the output I need instead of the default output that's it's giving me?
 
Not sure what you mean.
There's no title_raw but ->element_raw contains the raw value (same as ->value).

But be aware that it's no "Fabrik" form if you don't use the Fabrik output, so you can't use Fabrik functionality.
 
Thank you archartier! I'll have to look into this when I have the time. I've decided for now jut to tear the template apart and make it one page rather than spread it out. May end up a little messier but really it's the quickest fix to a short dealing. Once I figured out I can get every bit of information I need from $this->groups['Register']->elements in the default.php and just run a foreach on it and style it in the way I truly need from there it has become a bit easier of a project than worrying about other things. Still made up a jQuery script to find and replace all instances of span* with col-md-* so that's at least a plus for now.

Thank you both for your help!
 
Just be aware that a lot of the functionality in element JS classes and the main form class rely on the DOM structure, so if you make any significant changes to that, you'll break a lot of the JS. There's quite a lot of things like this.element.findClassUp('FabrikElementContainer'), etc goes on in the JS. You can still make quite significant changes, like replacing divs with spans, or table structures or whatever, but the over structure of what class sits inside what class is significant.

Just FYI, we are starting the long process of converting elements to using J! layouts, so you will be able to more easily override individual element layout, although it's never going to be as flexible as some folk would like, as yes, a lot of stuff is done in the models, which should really have been handled in views / templates.

-- hugh
 
Thank you for the response Cheese. Maybe I'll sit down after I get this crazy site up and going and I'll dig through some of the code for Fabrik and see if I can't separate some of the logic from the design a bit. Well if it's something the wonderful people here at farbik would want to review at least.
 
You'll run in to an awful lot of legacy issues. The current Fabrik code started life almost a decade ago, back in the Mambo days, and has just kind of grown as J! has grown ... and it'd be an awful lot of work to split out some of that stuff.

Not saying it wouldn't be a useful exercise, but it ain't gong to be easy. And we're focusing most of our development energy on f4 ...

-- hugh
 
How is the dev of f4 coming along? This is an amazing tool and I look forward to seeing what you have store for the future! The Juser plugin I find personally a very powerful tool if you're creating a site with many different kinds of memberships. Lets say a wholesaler/retailer site to allow retailers to easily find wholesalers. Building the custom registration forms for both would have been a major task if someone didn't have this plugin.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top