Ext: sg_twitter

License: GNU GPL, Version 2

Repository: https://gitlab.sgalinski.de/typo3/sg_twitter

Please report bugs here: https://gitlab.sgalinski.de/typo3/sg_twitter

TYPO3 version: >=9.5

About

This extension provides you with a plugin to render the latest tweets from a specific Twitter account or from a Twitter feed in your frontend.

Usage

Prerequisites

Before you can integrate the plugin, you need to get authorization from the Twitter account you would like to use. Go to (https://apps.twitter.com/), login with your Twitter account and create a new app.

You should now have the following information in the Keys and Access Token tab:

  • Consumer Key (API Key)
  • Consumer Secret (API Secret)

Permissions to read must be set.

Additionally, you need to create an access token for your Twitter app (also in the tab Keys and Access Token). This gives you an oauth access token and an oauth access token secret.

Now you have to add the information to your TypoScript constants:

plugin.tx_sgtwitter {
	settings {
		oauth_access_token = YOUR_OAUTH_ACCESS_TOKEN
		oauth_access_token_secret = YOUR_OAUTH_ACCESS_TOKEN_SECRET
		consumer_key = YOUR_CONSUMER_KEY
		consumer_secret = YOUR_CONSUMER_SECRET

		streamLifespan = Integer representing the time (in seconds) for how long the tweets are cached. If the stream result is older than this, a new request will be made
	}
}

Finally, include the TypoScript in your template.

JavaScript integration

The extension provides a JavaScript module that you need to import in your theme JS:

import SgTwitter from './../../../../sg_twitter/Resources/Public/JavaScript/sgtwitter';
Array.from(document.querySelectorAll('.tx-sg-twitter')).forEach((_item) => {
    new SgTwitter(_item);
});

Plugin options

After adding the plugin to your page you have the following options:

Twitter handle

Set this to determine from which Twitter account you want to see the latest tweets.

If this is not set, it uses the Twitter feed which you used to authorize sg_twitter instead.

Number of Tweets

How many tweets should be displayed? There is no maximum, so handle with care.

Exclude replies

Activate this option if you want to hide the replies to the tweets.

Include Retweets

Activate this option if you want to hide the retweets of the given account.

Display Twitter-Handles, Hashtags and URLs as hyperlinks

Activate this option if you want the user to visit Twitter by clicking on the handle or hashtag.