You are here

function vote_storylink_prepare in Vote Up/Down 5

Implementation of hook_prepare().

File

./vote_storylink.module, line 196

Code

function vote_storylink_prepare(&$node) {

  // Allow the following fields to be initialized via $_GET (e.g. for use
  // with a "submit it" bookmarklet):
  foreach (array(
    'title',
    'body',
  ) as $field) {
    if ($_GET['edit'][$field]) {
      $node->{$field} = $_GET['edit'][$field];
    }
  }
  if (isset($_POST['edit']['vote_storylink_url'])) {
    $node->vote_storylink_url = $_POST['edit']['vote_storylink_url'];
  }
  else {
    if ($_GET['edit']['url']) {
      $node->vote_storylink_url = check_url($_GET['edit']['url']);
    }
    else {
      if (empty($node->vote_storylink_url)) {
        $node->vote_storylink_url = 'http://';
      }
    }
  }
  vote_storylink_node_build($node);
}