EvTwitter Plugin
================

Authors: Andy Carter


Introduction
------------

Connects to Twitter and retrieves the user's Twitter feed.


Installation
------------

This is a composer plugin so from www/app just run composer as:-

	composer require evoluted/twitter

To setup the database use the CakeDC Migrations plugin. To run the migrations and setup the database run:-

	Console/cake Migrations.migration run all --plugin EvTwitter

Add the following to the plugin load array in 'app/Config/bootstrap.php':-

	'EvTwitter' => array('bootstrap' => true)

To setup the plugin's config create a new config file 'app/Config/Plugin/ev_twitter.php' with the following:-

$config = array(
	'EvTwitter' => array(
		'consumerKey' => 'XXX',
		'consumerSecret' => 'XXX'
	)
);

Without this file the plugin will throw an exception as these are required to use it.


Using EvTwitter Plugin
-----------------------

First, you will need to connect your application to Twitter. This can be done in one of two ways:

GLOBAL:
This is for sites which just have the one Twitter feed. Go to the URL "/admin/ev_twitter/twitter_connect" and just follow the setup.

ITEM-BASED:
You can set up Twitter feeds for specific items/pages on your site. The URL you will need to go to is /admin/ev_twitter/twitter_connect/index/__MODEL__/__MODELID__
Where:
__MODEL__ is the name of the model you're connecting
__MODELID__ is the ID of the model you're connecting

To include a Twitter feed on a page include the following in your controller:-

	$this->loadModel('EvTwitter.TwitterFeed');
	$this->set('twitter', $this->TwitterFeed->getFeed());

The function getFeed() accepts 2 parameters, both optional:
	$limit(int) - The number of Tweets you wish to pull out
	$conditions(array) - a standard Cake find parameter array [example: array('conditions'=>array('model'=>'foo', 'model_id'=>2))]

##Twitter Embed helper
The `TwitterEmbed` view helper returns the markup that is just to embed a Twitter feed into a view.

To use the helper, paste:
`<?= $this->TwitterEmbed->parse('[twitter=handle]') ?>`

You can use There are various options you can enter to customise the twitter feed. These can be added as space seperated values after `[twitter=handle]`. The available options are:

* width - Set the maximum width of the embedded Tweet
* height - Set a fixed height of the embedded widget
* theme - Display light text on a dark background
* link-color - Adjust the color of links
* dnt - When set to true, the timeline and its embedded page on your site are not used for purposes that include personalized suggestions and personalized ads
