Skip to content

Instantly share code, notes, and snippets.

@a-fro
Last active December 15, 2015 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a-fro/5221384 to your computer and use it in GitHub Desktop.
Save a-fro/5221384 to your computer and use it in GitHub Desktop.
<?php
/**
* @file
* Bean plugin for showing tweets for a specified twitter user
*/
/**
* Implements hook_bean_types_api_info().
*/
function bean_tweets_bean_types_api_info() {
return array('api' => 4);
}
/**
* Implements hook_bean_types().
*/
function bean_tweets_bean_types() {
$plugins = array();
$plugins['tweet_block'] = array(
'label' => t('Tweet'),
'description' => t('A listing of tweets for a given twitter user.'),
'handler' => array(
'class' => 'TweetBlockBean',
'parent' => 'bean',
'path' => drupal_get_path('module', 'bean_tweets') . '/plugins/bean',
'file' => 'bean_tweets.tweet_block.inc',
),
);
return $plugins;
}
/**
* form#sumbit handler.
*/
function bean_tweets_clear_cache(&$form){
cache_clear_all('bean_tweets-' . $form['settings']['handle']['#value'], 'cache');
}
/**
* Implements hook_menu().
*/
function bean_tweets_menu() {
$items = array();
$items['admin/settings/bean_tweets'] = array(
'title' => t('Bean Tweets OAuth'),
'description' => t('Configuration OAuth for Bean Tweets module'),
'page callback' => 'drupal_get_form',
'page arguments' => array('bean_tweets_admin'),
'file' => 'includes/bean_tweets.admin.inc',
'access arguments' => array('access administration pages'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment