How can I Override HWIOAuthBundle twig file

后端 未结 2 2025
伪装坚强ぢ
伪装坚强ぢ 2021-01-14 16:51

I am new in HWIOAuthBundle with Symfony2.3 +FosUserBundle. I am using this bundle for facebook, twitter, googleplus login in my project.

I have successfully install

2条回答
  •  终归单人心
    2021-01-14 17:38

    To be more specific about your case, you should create 2 new views:

    app/Resources/HWIOAuthBundle/views/layout.html.twig:

    {# extends your own base template #}
    {% extends 'MyBundle::layout.html.twig' %}
    
    {% block title %}{{ 'Login' | trans }}{% endblock %}
    
    {% block body %}
        {% block hwi_oauth_content %}
        {% endblock hwi_oauth_content %}
    {% endblock %}
    

    app/Resources/HWIOAuthBundle/views/Connect/login.html.twig:

    {% extends 'HWIOAuthBundle::layout.html.twig' %}
    
    {% block hwi_oauth_content %}
    
        {# Display oauth errors (here using Bootstrap) #}
        {% if error is defined and error %}
            
    {{ error }}
    {% endif %} {# HWIOAuthBundle integration #} {% endblock hwi_oauth_content %}

    Do not be tempted to put this login page in the first file, because OAUthBundle uses several other views (to confirm profile, etc).

    This example is taken from symfony-quickstart project.

提交回复
热议问题