1 [![Build Status](https://travis-ci.org/drupal-media/media_entity_twitter.svg?branch=8.x-1.x)](https://travis-ci.org/drupal-media/media_entity_twitter)
5 Media entity provides a 'base' entity for a media element. This is a very basic
6 entity which can reference to all kinds of media-objects (local files, YouTube
7 videos, tweets, CDN-files, ...). This entity only provides a relation between
8 Drupal (because it is an entity) and the resource. You can reference to this
9 entity within any other Drupal entity.
11 ## About Media entity Twitter
13 This module provides Twitter integration for Media entity (i.e. media type
16 ### Without Twitter API
17 If you need just to embedded tweets you can use this module without using
18 Twitter's API. That will give you access to the fields available from the
19 url/embed code: id and user.
23 - Create a Media bundle with the type provider "Twitter".
24 - On that bundle create a field for the Tweet url/source (this should be a plain
26 - Return to the bundle configuration and set "Field with source information" to
29 **IMPORTANT:** beware that there is limit on the number of request that can be
30 made for free. [Read more](https://dev.twitter.com/rest/public)
34 If you need to get other fields, you will need to use Twitter's API. To get this
35 working follow the steps below:
38 [composer_manager](https://www.drupal.org/project/composer_manager). Also make
39 sure you have [drush](https://github.com/drush-ops/drush) installed.
40 - Run the following commands from within your Drupal root directory to download
41 the [library](https://github.com/J7mbo/twitter-api-php) that will handle the
45 // Rebuild the composer.json file with updated dependencies.
46 $ drush composer-json-rebuild
48 // Install the required packages.
49 $ drush composer-manager install
51 - Create a twitter app on the twitter
52 [developer site](https://dev.twitter.com/apps/)
53 - Enable read access for your twitter app
54 - Grab your access tokens from the twitter developer site
55 - In your Twitter bundle configuration set "Whether to use Twitter api to fetch
56 tweets or not" to "Yes"" and paste in the "Consumer key", "Consumer secret",
57 "Oauth access token" and the "Oauth access token secret"
59 ### Storing field values
60 If you want to store the fields that are retrieved from Twitter you should create
61 appropriate fields on the created media bundle (image, content and
62 retweet_count) and map this to the fields provided by Twitter.php.
64 **NOTE:** At the moment there is no GUI for that, so the only method of doing
65 that for now is via CMI.
67 This would be an example of that (the field_map section):
74 - media_entity_twitter
77 description: 'Tweet to be used with content.'
81 source_field: field_tweet_source
83 consumer_key: YOUR_CONSUMER_KEY
84 consumer_secret: YOUR_CONSUMER_SECRET
85 oauth_access_token: YOUR_OAUTH_ACCESS_TOKEN
86 oauth_access_token_secret: YOUR_OAUTH_ACCESS_TOKEN_SECRET
88 source: field_tweet_source
90 content: field_tweet_content
93 Project page: http://drupal.org/project/media_entity_twitter
96 - Janez Urevc (@slashrsm) drupal.org/user/744628
97 - Primož Hmeljak (@primsi) drupal.org/user/282629
99 IRC channel: #drupal-media