You are here

public static function ShareaholicContentSettings::update in Share Buttons, Related Posts, Content Analytics - Shareaholic 8

Same name and namespace in other branches
  1. 7.3 content_settings.php \ShareaholicContentSettings::update()

Updates the content settings in the database with values selected in the content type form

Parameters

Object $node the node object that has been updated:

1 call to ShareaholicContentSettings::update()
shareaholic_node_update in includes/node.php
Implements hook_node_update(). When a node is updated, notify CM to scrape its details and clear FB cache

File

./content_settings.php, line 52

Class

ShareaholicContentSettings
An interface to the Shareaholic Content Settings database table

Code

public static function update($node) {
  if (!db_table_exists('shareaholic_content_settings')) {
    return;
  }
  if (db_select('shareaholic_content_settings', 'settings')
    ->fields('settings')
    ->condition('nid', $node->nid, '=')
    ->execute()
    ->fetchAssoc()) {
    db_update('shareaholic_content_settings')
      ->fields(array(
      'settings' => self::serialize_settings($node),
    ))
      ->condition('nid', $node->nid)
      ->execute();
  }
  else {

    // If not found insert it as a new node
    self::insert($node);
  }
}