Closed weidmaster closed 2 years ago
You can do the following tiny change (Quick fix)
Go to: "plugins\martin\forms\controllers\records"
folder
Edit this file: "view.htm"
Chnage this:
<td class="record-label"><?php echo ucwords($label) ?>:</td>
Into this
<td class="record-label"><?php echo ucwords(str_replace('_', ' ', $label)) ?>:</td>
If you're also facing the same issue in mail template:
Change
{{ label|capitalize}}:
Into this:
{{ label|capitalize|replace({'_': ' '}) }}:
@skydiver @weidmaster
@tareq-halaby I will test this, but from what I see this will only make the label show with space and not use a custom text right? As PHP won't get data-
attributes from html, I think the approach is in the right direction, so maybe using some other replace technique to get a custom text from the name attribute, like name="qty_filhos|quantidade_de_filhos"
and parsing it to remove the pipe and then replace the underscores.
I tested the plugin and it is working as intended, both the generic form and the upload ajax one, but I didn't find in the documentation, or in the examples, a way to have custom label for the form fields name.
You see, it would be better for presentation of the form to a client if we could change the label in the data table of the fields sent in the backed. I think the approach would be to have data attributes, like
data-label="something else"
and so the plugin would check for this data attribute and change the label accordingly.As you can see in my example and screenshot, the ideal would be to use english names for the form field names, but I had to change it to portuguese so the client can understand what the data is about in the backend.
Form code snippet:
Screenshot of result data in backend:
Example of modified code and result data