You are here

function shareaholic_node_submit in Share Buttons, Related Posts, Content Analytics - Shareaholic 7.3

Same name and namespace in other branches
  1. 8 includes/node.php \shareaholic_node_submit()

Implements hook_node_submit().

Retrieve the inputs to the shareaholic options form

File

includes/node.php, line 161
This file is responsible for containing hooks involving nodes

Code

function shareaholic_node_submit($node, $form, &$form_state) {
  $values = $form_state['values'];

  // Move the new data into the node object.
  // This is why I namespaced it: the form values does not preserve shareaholic_options
  $isChecked = $values['shareaholic_exclude_from_recommendations'] === 1 ? true : false;
  $node->shareaholic_options['shareaholic_exclude_from_recommendations'] = $isChecked;
  $isChecked = $values['shareaholic_hide_recommendations'] === 1 ? true : false;
  $node->shareaholic_options['shareaholic_hide_recommendations'] = $isChecked;
  $isChecked = $values['shareaholic_hide_share_buttons'] === 1 ? true : false;
  $node->shareaholic_options['shareaholic_hide_share_buttons'] = $isChecked;
  $isChecked = $values['shareaholic_exclude_og_tags'] === 1 ? true : false;
  $node->shareaholic_options['shareaholic_exclude_og_tags'] = $isChecked;
}