Skip to content

Instantly share code, notes, and snippets.

View apphancer's full-sized avatar

Martin apphancer

View GitHub Profile
@ThePeterMick
ThePeterMick / register.html.twig
Last active August 14, 2020 06:41
Customise checkbox label for bootstrap 4 in Twig for Symfony 4
{% form_theme form _self %}
{% block checkbox_radio_label -%}
{# {% block _user_registration_form_termsAccepted_label %} - use this if you need it for just a single field, amend accordingly to your form type/field #}
{#- Do not display the label if widget is not defined in order to prevent double label rendering -#}
{%- if widget is defined -%}
{% set is_parent_custom = parent_label_class is defined and ('checkbox-custom' in parent_label_class or 'radio-custom' in parent_label_class) %}
{% set is_custom = label_attr.class is defined and ('checkbox-custom' in label_attr.class or 'radio-custom' in label_attr.class) %}
{%- if is_parent_custom or is_custom -%}
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' custom-control-label')|trim}) -%}
@ThePeterMick
ThePeterMick / register.html.twig
Last active April 18, 2019 12:28
Display label and checkbox separately for bootstrap 4 in Twig for Symfony 4
{% form_theme form _self %}
{% block checkbox_widget -%}
{%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%}
{%- if 'checkbox-custom' in parent_label_class -%}
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' custom-control-input')|trim}) -%}
<div class="custom-control custom-checkbox{{ 'checkbox-inline' in parent_label_class ? ' custom-control-inline' }}">
{{ block('checkbox_widget_base') }}
</div>
{%- else -%}
@apphancer
apphancer / package.json
Created January 16, 2018 16:08 — forked from elmariachi111/package.json
webpack production demo file
{
"name": "symfony",
"version": "1.0.0",
"description": "Symfony Standard Edition ========================",
"main": "index.js",
"directories": {
"test": "tests"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
@elmariachi111
elmariachi111 / package.json
Last active May 24, 2020 13:08
webpack production demo file
{
"name": "symfony",
"version": "1.0.0",
"description": "Symfony Standard Edition ========================",
"main": "index.js",
"directories": {
"test": "tests"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",