Adding Tweet Button Support to a Module
How to integrate Twitter Tweets button into a module.
1. Update the Controller by ensuring that 'twitter' is NOT within the $remove_configs array. Otherwise, the Twitter tab will never be displayed in module configuration settings to turn the feature on.
2. Update the item ‘show’ or 'showall' templates by adding the code for the optional Tweet button (assuming the item is referred to as $record):
{if $config.enable_tweet} <a href="https://twitter.com/share" class="twitter-share-button" data-url="{$smarty.const.URL_FULL}{$record->sef_url}" data-text="{$record->title}"{if $config.layout} data-count="{$config.layout}"{/if}{if $config.size} data-size="{$config.size}"{/if} data-lang="en">{'Tweet'|gettext}</a> {script unique='tweet_src'} {literal} !function(d,s,id){ var js,fjs=d.getElementsByTagName(s)[0]; if(!d.getElementById(id)){ js=d.createElement(s); js.id=id; js.src="https://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js,fjs); } }(document,"script","twitter-wjs"); {/literal} {/script} {/if}
Loading Help