--- id: type: 'string' class: type: 'string' default: 'form-control' placeholder: type: 'string' default: '' required: type: 'bool' default: false autofocus: type: 'bool' default: false name: type: 'string' default: '' value: type: 'string' default: '' attributes: type: 'string' default: '' label: type: 'hash' default: es: 'Edad' en: 'Age' ar: 'Age' --- {% assign age_attributes = attributes | append: ' ' | append: 'readonly data-dob-target="age"' %} {% assign attributes = 'data-dob-target="date" data-action="dob#update"' %} {% assign suffix = label[locale] | downcase | replace: ' ', '_' %} {% if name contains ']' %} {% comment %} The extra space is a trick so we can recover the entire string because the replace_last implementation misses the search string if it's at the end of the string. {% endcomment %} {% assign age_name = name | append: ' ' | replace_last: ']', '_' | strip | append: suffix | append: ']' %} {% assign age_id = name | append: '_' | append: suffix | replace: '[', '_' | remove: ']' %} {% else %} {% assign age_name = name | append: '_' | append: suffix %} {% assign age_id = id | append: '_' | append: suffix %} {% endif %}