You are here

function twitter_block_custom_block_save in Twitter Block 7.2

Same name and namespace in other branches
  1. 7 twitter_block.module \twitter_block_custom_block_save()

Saves a user-created Twitter block in the database.

Parameters

$edit: Associative array of fields to save. Array keys:

  • info: Block description.
  • widget_id: Widget ID.
  • username: Account username.
  • theme: Theme.
  • link_color: Link color.
  • width: Width.
  • height: Height.
  • chrome: Chrome.
  • border_color: Border color.
  • language: Language.
  • tweet_limit: Tweet limit.
  • related: Related users.
  • polite: ARIA politeness.

$delta: Block ID of the block to save.

Return value

Always returns TRUE.

1 call to twitter_block_custom_block_save()
twitter_block_block_save in ./twitter_block.module
Implements hook_block_save().

File

./twitter_block.module, line 379
A module to provide simple Twitter blocks using the Twitter Search API.

Code

function twitter_block_custom_block_save($edit, $delta) {

  // The serialized 'data' column contains the timeline settings.
  $data = array(
    'theme' => $edit['theme'],
    'link_color' => $edit['link_color'],
    'width' => $edit['width'],
    'height' => $edit['height'],
    'chrome' => $edit['chrome'],
    'border_color' => $edit['border_color'],
    'language' => $edit['language'],
    'tweet_limit' => $edit['tweet_limit'],
    'related' => $edit['related'],
    'polite' => $edit['polite'],
  );

  // Save the block configuration.
  $delta = db_update('twitter_block')
    ->fields(array(
    'info' => $edit['info'],
    'widget_id' => $edit['widget_id'],
    'username' => $edit['username'],
    'data' => serialize($data),
  ))
    ->condition('bid', $delta)
    ->execute();
  return TRUE;
}