|
| 1 | +{# |
| 2 | + # @param string provider [facebook, twitter, yahoo, messenger, google, etc...] |
| 3 | + # @param string redirectURL |
| 4 | + # @param boolean pendingRegistration [default == false] |
| 5 | + # @param integer sessionExpiration [default == 0] |
| 6 | + # @param string facebookExtraPermissions [optional] rsvp_event,sms |
| 7 | + # @param boolean authCodeOnly [default == false] |
| 8 | + # @param string callback [optional] |
| 9 | + # @param string cid [optional] |
| 10 | + # @param string context [optional] |
| 11 | + #} |
| 12 | + |
| 13 | +{% set apiKey = gigya_socializer.apiKey %} |
| 14 | +{% set namespace = gigya_socializer.namespace %} |
| 15 | +{% set loginFunctionName = gigya_socializer.loginFunctionName %} |
| 16 | + |
| 17 | +<script type="text/javascript"> |
| 18 | +{% if namespace != 'window' %} |
| 19 | +if ({{ namespace }} == null || typeof({{ namespace }}) != 'object') { var {{ namespace }} = window.{{ namespace }} = {}; } |
| 20 | +{% endif %} |
| 21 | +
|
| 22 | +{{ loginFunctionName }} = function() { |
| 23 | + if (typeof gigya != 'undefined') { |
| 24 | + if (typeof console != 'undefined') console.log('Gigya:\n-- {{ loginFunctionName }} executed and source library already instantiated'); |
| 25 | +
|
| 26 | + var conf = { |
| 27 | + APIKey: '{{ apiKey }}' |
| 28 | + }; |
| 29 | +
|
| 30 | + // Parameters for the showLoginUI method |
| 31 | + var params = { |
| 32 | + containerID: '{{ containerID }}' // The container for the component |
| 33 | + {% if redirectURL %} |
| 34 | + ,redirectURL: '{{ redirectURL }}' // |
| 35 | + {% endif %} |
| 36 | + ,height: {{ height | escape('js') }} |
| 37 | + ,width: {{ width | escape('js') }} |
| 38 | + {% if showTermsLink %} |
| 39 | + ,showTermsLink: {{ showTermsLink }} // remove 'Terms' link |
| 40 | + {% else %} |
| 41 | + ,showTermsLink: false // remove 'Terms' link |
| 42 | + {% endif %} |
| 43 | + {% if hideGigyaLink %} |
| 44 | + ,hideGigyaLink: {{ hideGigyaLink }} // remove 'Gigya' link |
| 45 | + {% else %} |
| 46 | + ,hideGigyaLink: true // remove 'Gigya' link |
| 47 | + {% endif %} |
| 48 | + {% if not buttonsStyle %} |
| 49 | + ,buttonsStyle: 'standard' // Change the default buttons design to "Full Logos" design |
| 50 | + {% else %} |
| 51 | + ,buttonsStyle: '{{ buttonsStyle }}' // Change the default buttons design to "Full Logos" design |
| 52 | + {% endif %} |
| 53 | + {% if showWhatsThis %} |
| 54 | + ,showWhatsThis: {{ showWhatsThis }} // Pop-up a hint describing the Login Plugin, when the user rolls over the Gigya link. |
| 55 | + {% else %} |
| 56 | + ,showWhatsThis: true // Pop-up a hint describing the Login Plugin, when the user rolls over the Gigya link. |
| 57 | + {% endif %} |
| 58 | + {% if cid %} |
| 59 | + ,cid: '{{ cid }}' |
| 60 | + {% else %} |
| 61 | + ,cid: '' |
| 62 | + {% endif %} |
| 63 | + }; |
| 64 | + |
| 65 | + // Show the "login" widget |
| 66 | + gigya.services.socialize.login(conf, params); |
| 67 | + } else { |
| 68 | + if (typeof console != 'undefined') console.log("Gigya:\n-- typeof gigya == "+typeof gigya+"\n-- Reattempting instantiation in 100 milliseconds"); |
| 69 | + setTimeout(function(){ |
| 70 | + {{ loginFunctionName }}(); |
| 71 | + },100); |
| 72 | + } |
| 73 | +} |
| 74 | +
|
| 75 | +{{ loginFunctionName }}(); |
| 76 | +</script> |
| 77 | + |
| 78 | +{# TODO Support other javascript libraries #} |
| 79 | +{% if library == 'jquery' %} |
| 80 | + {% include "GigyaBundle:Socializer:login_handlers_jquery.html.twig" with { 'onLoginHandler': onLoginHandler, 'onLogoutHandler': onLogoutHandler, 'onLogoutParams': onLogoutParams} %} |
| 81 | +{% else %} |
| 82 | + {% include "GigyaBundle:Socializer:login_handlers_jquery.html.twig" with { 'onLoginHandler': onLoginHandler, 'onLogoutHandler': onLogoutHandler, 'onLogoutParams': onLogoutParams} %} |
| 83 | +{% endif %} |
0 commit comments