Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{% for field in user.profileFields %}
<div class="row">
<div class="alert alert-info">
{{ translate('USER.PROFILE.' ~ field.slug|upper) }}
</div>
</div>
{% endfor %}
</div>
<div class="col-xs-6">
{% for field in user.profileFields %}
<div class="row">
<div class="alert {% if fields.value == 'yes' %}alert-success{% elseif fields.value starts with 'yes' %}alert-warning{% elseif fields.value == 'no' %} alert-danger{% else %}alert-info{% endif %}">
{{ fields.value }}
</div>
</div>
{% endfor %}
// ...
$user = User::with('profileFields')->get();
return $this->ci->view->render($response, 'foo.html.twig', [
'user' => $user
]);
return [
'USER' => [
'PROFILE' => [
'LOCATION' => 'User location',
'GENDER' => 'User gender',
'OCCUPATION' => 'User occupation',
]
]
];
{
"location" : {
"validators" : {
"length" : {
"label" : "USER.PROFILE.LOCATION",
"min" : 1,
"max" : 255,
"message" : "VALIDATE.LENGTH_RANGE"
}
},
"form": {
"type": "text",
"label": "LOCATION",
"icon": "fa-globe"
}
},
"occupation" : {
"validators" : {
"length" : {
"label" : "USER.PROFILE.OCCUPATION",
"min" : 1,
"max" : 255,
"message" : "VALIDATE.LENGTH_RANGE"
}
},
"form": {
"type": "textarea",
"label": "OCCUPATION",
"icon": "fa-briefcase"
}
},
"gender" : {
"validators" : {},
"form": {
"type": "select",
"label": "USER.PROFILE.GENDER",
"icon": "fa-transgender",
"options" : {
"1" : "GENDER.MALE",
"2" : "GENDER.FEMALE",
"3" : "GENDER.NEUTRAL"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.