You are here

class TwitterTimelineBean in Twitter Timeline 7

@file Twitter Pull bean plugin.

Hierarchy

Expanded class hierarchy of TwitterTimelineBean

1 string reference to 'TwitterTimelineBean'
twitter_timeline_bean_types in ./twitter_timeline.module
Implements hook_bean_types().

File

plugins/bean/twitter_timeline.inc, line 7
Twitter Pull bean plugin.

View source
class TwitterTimelineBean extends BeanPlugin {

  /**
   * Declares default block settings.
   */
  public function values() {
    return array(
      'settings' => array(
        'widget_id' => '',
        'placeholder_text' => '',
        'placeholder_url' => '',
      ),
    );
  }

  /**
   * Builds extra settings for the block edit form.
   */
  public function form($bean, $form, &$form_state) {
    $form = array();
    $form['settings'] = array(
      '#type' => 'fieldset',
      '#tree' => 1,
      '#title' => t('Options'),
    );
    $form['settings']['widget_id'] = array(
      '#type' => 'textfield',
      '#title' => t('Widget ID'),
      '#description' => t('ID of the widget to embed.'),
      '#size' => 25,
      '#maxlength' => 25,
      '#default_value' => isset($bean->settings['widget_id']) ? $bean->settings['widget_id'] : '',
    );
    $form['settings']['placeholder_text'] = array(
      '#type' => 'textfield',
      '#title' => t('Placeholder text'),
      '#description' => t('Text to display while the twitter widget loads.'),
      '#default_value' => isset($bean->settings['placeholder_text']) ? $bean->settings['placeholder_text'] : '',
    );
    $form['settings']['placeholder_url'] = array(
      '#type' => 'textfield',
      '#title' => t('Placeholder url'),
      '#description' => t('Link for the placeholder text.'),
      '#default_value' => isset($bean->settings['placeholder_url']) ? $bean->settings['placeholder_url'] : '',
    );
    return $form;
  }

  /**
   * Displays the bean.
   */
  public function view($bean, $content, $view_mode = 'default', $langcode = NULL) {
    $content['twitter_timeline']['#markup'] = twitter_timeline_render($bean->settings['widget_id'], $bean->settings['placeholder_text'], $bean->settings['placeholder_url']);
    return $content;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BeanPlugin::$plugin_info protected property
BeanPlugin::$type public property
BeanPlugin::buildURL public function Build the URL string Overrides BeanTypePluginInterface::buildURL
BeanPlugin::getDescription public function Get the description Overrides BeanTypePluginInterface::getDescription
BeanPlugin::getInfo public function Get Plugin info Overrides BeanTypePluginInterface::getInfo
BeanPlugin::getLabel public function Get the label Overrides BeanTypePluginInterface::getLabel
BeanPlugin::isEditable public function Is the bean type editable Overrides BeanTypePluginInterface::isEditable
BeanPlugin::setBean public function Add a Bean to the plugin Overrides BeanTypePluginInterface::setBean
BeanPlugin::submit public function React to the saving of the bean Overrides BeanTypePluginInterface::submit
BeanPlugin::validate public function THe plugin validation function Overrides BeanTypePluginInterface::validate
BeanPlugin::__construct public function Constructor Overrides BeanTypePluginInterface::__construct
TwitterTimelineBean::form public function Builds extra settings for the block edit form. Overrides BeanPlugin::form
TwitterTimelineBean::values public function Declares default block settings. Overrides BeanPlugin::values
TwitterTimelineBean::view public function Displays the bean. Overrides BeanPlugin::view