material_admin-8.x-1.0-alpha7/templates/buttons/input--switch.html.twig

templates/buttons/input--switch.html.twig
{#
/**
 * @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) %}
  <div class="switch">
    <label{{ switch_label }}>
      <i class="material-icons">lock</i>
    </label>
  </div>
{% else %}
  <div class="switch">
  <label{{ switch_label }}>
    {% block switch_before_text %}On{% endblock %}
    <input{{ attributes }} />{{ children }}
    <span class="lever"></span> 
    {% block switch_after_text %}Off{% endblock %}
  </label>
</div>
{% endif %}


Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc