Should Tweetbutton be a field? It would be easy to manage using Fields UI
and will have generalized support for all entities(user/node/taxonomy) and bundles.
Comments/Suggestions?

Comments

pribeh’s picture

bump.

BenK’s picture

Subscribing...

andypost’s picture

widget should automaticaly fetch data from account?

chia’s picture

1) Tweetbutton widget will have better token and view mode support (different style in teaser or full mode),
2) adjustable weight using Fields UI.
3) We can make better use of related accounts feature (recommend following Author) http://twitter.com/goodies/tweetbutton
These are few things that i have in mind.

travisc’s picture

Views field support is critical for themers. Plus 1 for making this happen.

tsvenson’s picture

+1 for adding this flexibility to it.

Agogo’s picture

This is not even close to a patch, but I made a quick fix for a site Ive been working on to make the button available as a field and thought Id share the code in hope that it might help someone in the process. It requires Display Suite since the hooks used is from that module.
http://drupal.org/project/ds

I used this code in a custom made module for this specific project.

function mymodule_ds_fields_info($entity_type) {
  $fields = array();
  if ($entity_type == 'node') {
    $fields['mymodule_tweetbutton'] = array(
      'title' => t('Twitter'),
      'field_type' => DS_FIELD_TYPE_FUNCTION,
      'function' => 'mymodule_ds_tweetbutton_field',
    );
    return array('node' => $fields);
  }
}

function mymodule_ds_tweetbutton_field($field) {
  if (module_exists('tweetbutton')) {
    if (user_access('access tweetbutton')) {

      drupal_add_js('http://platform.twitter.com/widgets.js');
      drupal_add_css(drupal_get_path('module', 'tweetbutton').'/tweetbutton.css');

      $token_replacements = array(
        '!title'        => $field['entity']->title,
        '!author_name'  => $field['entity']->name,
        '!node_type'    => $field['entity']->type,
        '!node_url'     => url('node/'.$field['entity']->nid, array('absolute' => TRUE)),
      );

    $content['tweetbutton'] = array(
        '#tokens'   => $token_replacements,
        '#theme'    => 'tweetbutton_display',
      );

       return drupal_render($content['tweetbutton']);
    }
  }
}

chia’s picture

Version:7.x-1.x-dev» 7.x-2.x-dev
Status:Active» Needs review
Issue tags:+Needs manual testing

Created a 7.x-2.x branch, added tweetbutton as a field.

maerys’s picture

Status:Needs review» Needs work

Installed it, made the field, integrated it within page manager, but nothing shows up except this prompt:

Notice: Undefined offset: 0 in tweetbutton_field_formatter_view() (Zeile 153 von /home/www/acquia7/sites/all/modules/tweetbutton/tweetbutton.module).
Notice: Undefined offset: 0 in tweetbutton_field_formatter_view() (Zeile 154 von /home/www/acquia7/sites/all/modules/tweetbutton/tweetbutton.module).
Notice: Undefined property: stdClass::$uri in tweetbutton_field_formatter_view() (Zeile 155 von /home/www/acquia7/sites/all/modules/tweetbutton/tweetbutton.module).
chia’s picture

Status:Needs work» Fixed

Thanks for reporting the issue,
The latest commit should fix this.

Status:Fixed» Closed (fixed)
Issue tags:-Needs manual testing

Automatically closed -- issue fixed for 2 weeks with no activity.