Custom address attribute
Permalink
Hi,
I need a custom address attribute because I want some extra fields (like buildingNumber). In the 5.6 days, I created a copy of the C5 address attribute and that worked just fine.
How can I achieve this in 5.8?
I see an example in the documentation (https://documentation.concrete5.org/developers/attributes/creating-custom-attribute-types/extending-a-core-attribute-type). Is this the new way of getting things done?
Any ideas?
I need a custom address attribute because I want some extra fields (like buildingNumber). In the 5.6 days, I created a copy of the C5 address attribute and that worked just fine.
How can I achieve this in 5.8?
I see an example in the documentation (https://documentation.concrete5.org/developers/attributes/creating-custom-attribute-types/extending-a-core-attribute-type). Is this the new way of getting things done?
Any ideas?
Thanks for your reply.
I know it is up to date. I was just wondering if this is the way to go. I think I have to try and see if it works for me. My first Idea was to copy the address attribute. Not the way to go in 5.8 it seems.
I know it is up to date. I was just wondering if this is the way to go. I think I have to try and see if it works for me. My first Idea was to copy the address attribute. Not the way to go in 5.8 it seems.
By default 5.8 does not display the address attribute as an option in the user attributes selection or the collection attributes selection.
You can make them available by going to dashboard/system/attributes/types and ticking the relevant boxes i.e. Collection and/or User.
You will then be able to create your custom address attributes from the selection that is now available.
You can make them available by going to dashboard/system/attributes/types and ticking the relevant boxes i.e. Collection and/or User.
You will then be able to create your custom address attributes from the selection that is now available.
That is not my problem. I know how to use the (c5)address attribute. I just want to create my own custom address attribute. The default address attribute does not have the fields I need.
In c56 I created a custom address attribute (copied the attribute and adjusted it accordingly).
I'm not sure the approach in the documentation is the way to setup a new (address)attribute. Probably it would, but I don't see the solution yet. Going to try and see where it all ends.
In c56 I created a custom address attribute (copied the attribute and adjusted it accordingly).
I'm not sure the approach in the documentation is the way to setup a new (address)attribute. Probably it would, but I don't see the solution yet. Going to try and see where it all ends.
Yes, I understand..
Good Luck.
Good Luck.
Before v8 everything for the attribute was pretty much encapsulated in it so making a copy and modifying the copy would work.
Now attributes rely on value entities and settings entities that are decoupled so copying an attribute is way more complicated.
The explanation for the official doc is the way to go
Now attributes rely on value entities and settings entities that are decoupled so copying an attribute is way more complicated.
The explanation for the official doc is the way to go
Thanks.
I'm playing with it right now. The example is a bit different, because of the used object (Location). But I'll get there ;-)
I'm playing with it right now. The example is a bit different, because of the used object (Location). But I'll get there ;-)
@SnefIT did you ever get your new address attribute to work?
I'm trying to do a similar thing. As @mnakalay says this now seems way more complicated than before.
I need to change field names, add a field and remove the state select list for a custom address format and can't work out if I can do this by overriding the existing Address attribute or if I need to create a new one.
I'm trying to do a similar thing. As @mnakalay says this now seems way more complicated than before.
I need to change field names, add a field and remove the state select list for a custom address format and can't work out if I can do this by overriding the existing Address attribute or if I need to create a new one.
At first it seems to be much more difficult than before, but when you follow the instructions in the documentation, you'll see that it is not so difficult.
Follow the pages (not only the first one!), then you'll have what you want. And almost as before ;-)
Start with the example and look at the end result. At the end you can have a custom attribute with it's own database table(s).
I'll have to create it again. I've seen it worked and then removed it.
Follow the pages (not only the first one!), then you'll have what you want. And almost as before ;-)
Start with the example and look at the end result. At the end you can have a custom attribute with it's own database table(s).
I'll have to create it again. I've seen it worked and then removed it.
That documentation page was added on Dec 15, 2016. I believe it is up to date.