{# /** * @file * Theme override for an 'input' #type form element. * * Available variables: * - attributes: A list of HTML attributes for the input element. * - children: Optional additional rendered elements. * * @see template_preprocess_input() */ #} {% set classes = [ 'switch-label', attributes.disabled == 'disabled' ? 'tooltipped' ] %} {# make label an attribute so we can add conditional classes and attributes #} {% set switch_label = create_attribute().addClass(classes) %} {# if the switch is disabled, give a reason why. #} {% if attributes.disabled == 'disabled' %} {% set tooltip_text = tooltip_text | default('Disabled') %} {% set tooltip_delay = tooltip_delay | default('50') %} {% set switch_label = switch_label.setAttribute('data-enter-delay', tooltip_delay).setAttribute('data-tooltip', tooltip_text) %}
lock
{% else %}
{% block switch_before_text %}On{% endblock %} {{ children }} {% block switch_after_text %}Off{% endblock %}
{% endif %}