Easily display tweets filtered by Twitter handle, timeline, or search term in a Drupal block. You can control how many tweets should display and whether to include replies or retweets.
A single set of Twitter app credentials is used site-wide, but each block instance can display different tweets with different display settings.
This module uses the application only (read-only access to public information) via the Twitter API.
By design, theming is minimal. Developers are expected to customize the display via their chosen theme.
Configuration
- You first need a Twitter App. Sign in to Twitter and go to https://apps.twitter.com/ . Copy the "key" and "secret" associated with your new app.
- After installing the module in Drupal, go to Configuration > Media > Twitter Widgets (admin/config/media/twitter_profile_widget). Enter the Twitter App key and secret you created in step 1.
- Go to Admin > Structure > Block Layout > Custom Block Library > Add custom block (/block/add) and create one or more widgets.
Staying secure
Your Twitter app consumer key and consumer secret will be stored in a Drupal configuration entity. If using version control and configuration management, use a tool such as config_ignore and config_exclude to prevent exposing your Twitter app credentials, or a Drupal core solution such as $settings['config_exclude_modules'].
For non-UI management & deployment across environments, consider referencing these credentials through the filesystem, either through reference via settings.php or the equivalent:
$path = 'sites/default/files/private/twitter.json';
if (file_exists($path)) {
$json_text = file_get_contents('sites/default/files/private/twitter.json');
$twitter_widget = json_decode($json_text, TRUE);
$config['twitter_profile_widget.settings']['twitter_widget_key'] = $twitter_widget['twitter_widget_key'];
$config['twitter_profile_widget.settings']['twitter_widget_secret'] = $twitter_widget['twitter_widget_secret'];
}
Attachment | Size |
---|---|
twitter_widget_screenshot.png | 186.34 KB |
twitter-display-screenshot.png | 89.96 KB |
Project information
- Module categories: Media
- Ecosystem: Twitter, Social media
- 274 sites report using this module
- Created by Spleshka on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Minor cleanup issues