Skip to content

Instantly share code, notes, and snippets.

@imsamthomas
Last active August 4, 2016 08:31
Show Gist options
  • Save imsamthomas/c146d29d5b727049d2dde37488f024c8 to your computer and use it in GitHub Desktop.
Save imsamthomas/c146d29d5b727049d2dde37488f024c8 to your computer and use it in GitHub Desktop.
Add code to template file
<?php echo $this->getLayout()->createBlock("Mageplaza\Sociallogin\Block\Buttons")->setTemplate("Mageplaza_Sociallogin::buttons.phtml")->setSocialNetworks('Google,Yahoo,Facebook')->toHtml(); ?>
You can put a social login button block on a CMS page
{{block class="Mageplaza\Sociallogin\Block\Buttons" name="buttons.sociallogin" template="Mageplaza_Sociallogin::buttons.phtml" social_networks="Google,Yahoo,Facebook"}}
Please copy and paste the code below to one of xml layout files where you want to show the social button block.
<block class="Mageplaza\Sociallogin\Block\Buttons" name="buttons.sociallogin" template="Mageplaza_Sociallogin::buttons.phtml">
<action method="setSocialNetworks">
<social_networks>Google,Yahoo,Facebook</social_networks>
</action>
</block>
Below is a code example of a block with 4 social login buttons shown on the left of the category page.
<?xml version="1.0"?>
<layout version="0.1.0">
<catalog_category_default>
<reference name="left">
<block class="Magento\Catalog\Block\Navigation" name="catalog.leftnav" after="currency" template="Magento_Catalog::navigation/left.phtml"/>
<block class="Mageplaza\Sociallogin\Block\Buttons" name="buttons.sociallogin" template="Mageplaza_Sociallogin::buttons.phtml">
<action method="setSocialNetworks"><argument="social_networks" xsi:type="string">Google,Yahoo,Facebook</argument></action>
</block>
</reference>
</catalog_category_default>
</layout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment