Field Name (number) changed to text #7
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#7
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I encountered an issue that I'm not sure if it was by design or an issue.
When creating a field, if I set the address to something like myfield2, upon compile and install the database shows the field as myfieldtwo. It takes the 2 and converts it to two.
This also happens with default values. If I set default="10" it converts this to "ten" upon compile and install.
It looks like this only happens in fields.
Yes you are right it is by design. Since fields are used in so many conventions where numbers don't work well and can cause errors. We chose to just convert all field names to text only.
As far as I know the default value is not changed so if you can give me a link to the code I can take a look. It could be that you are speaking of default values in another way than I am understanding.
So to me default values are in the fields area
default="10"
will stay 10.Now if you need to iterate fields and therefore want the numbers there is a way to do this with the same function in the helper class called safeString.
So lets say you have four fields myfield1 to myfield4 that you want to target you can do the following:
You can in the helper file look at the safeString method to see what it does.
Note that ComponentHelper:: will be the name of your component with Helper added to it.
Hope this helps.
Just a headsup note, if you make the default field in fieldtype translatable then it will change it to a string.