From b12976ae99a1b052e695a90e263e6d8ab642e8d5 Mon Sep 17 00:00:00 2001 From: Aaron Armstrong Date: Thu, 10 Mar 2016 14:39:39 -0500 Subject: [PATCH] Add functionality to add widget height Widget height also removes the tweet limit - as per documentation from https://dev.twitter.com/web/embedded-timelines --- plugins/bean/wetkit_bean.twitter.inc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/bean/wetkit_bean.twitter.inc b/plugins/bean/wetkit_bean.twitter.inc index 3acadb3..abaf955 100644 --- a/plugins/bean/wetkit_bean.twitter.inc +++ b/plugins/bean/wetkit_bean.twitter.inc @@ -18,6 +18,7 @@ class WetKitTwitterBean extends BeanPlugin { 'search_query' => '', 'widget_id' => '', 'tweet_limit' => '', + 'widget_height' => '', ), ); @@ -117,6 +118,13 @@ class WetKitTwitterBean extends BeanPlugin { '#options' => array('' => drupal_map_assoc(range(1, 20))), '#description' => t('Fix the size of a timeline to a preset number of Tweets between 1 and 20. The timeline will render the specified number of Tweets from the timeline, expanding the height of the widget to display all Tweets without scrolling.'), ); + + $form['twitter_settings']['widget_height'] = array( + '#type' => 'textfield', + '#title' => t('Widget Height'), + '#default_value' => isset($bean->twitter_settings['widget_height']) ? $bean->twitter_settings['widget_height'] : '', + '#description' => t('This is where you would select the height of your twitter widget. If widget height is selected, your tweet limit will NOT work. '), + ); return $form; } @@ -134,6 +142,7 @@ class WetKitTwitterBean extends BeanPlugin { $username = isset($bean->twitter_settings['username']) ? $bean->twitter_settings['username'] : ''; $search_query = isset($bean->twitter_settings['search_query']) ? $bean->twitter_settings['search_query'] : ''; $tweet_limit = isset($bean->twitter_settings['tweet_limit']) ? 'data-tweet-limit="' . $bean->twitter_settings['tweet_limit'] . '"' : ''; + $widget_height = isset($bean->twitter_settings['widget_height']) ? $bean->twitter_settings['widget_height'] : ''; // Twitter method. $url = "https://twitter.com/"; @@ -155,7 +164,9 @@ class WetKitTwitterBean extends BeanPlugin { // Rendered markup. $markup = '
'; $markup .= (empty($title)) ? '' : '

' . $title . '

' ; - $markup .= ''; + $markup .= '