You are here

function vote_storylink_node_build in Vote Up/Down 5

To use the links API, we sometimes need to populate the internal data structure $node->vote_storylink, which is an array of link-definition arrays. In this case, the outer array always contains exactly one element because we are interested only in the primary URL for the storylink. If this site allows "related links" for storylink nodes, that's handled by the links_related module, not here.

5 calls to vote_storylink_node_build()
vote_storylink_delete in ./vote_storylink.module
Implementation of hook_delete().
vote_storylink_insert in ./vote_storylink.module
Implementation of hook_insert().
vote_storylink_prepare in ./vote_storylink.module
Implementation of hook_prepare().
vote_storylink_update in ./vote_storylink.module
Implementation of hook_update().
vote_storylink_validate in ./vote_storylink.module
Implementation of hook_validate().

File

./vote_storylink.module, line 553

Code

function vote_storylink_node_build(&$node, $url = '') {
  if (empty($url)) {
    $url = links_normalize_url($node->vote_storylink_url);
  }
  else {
    $url = links_normalize_url($url);
  }
  $node->vote_storylink_url = $url;
  $link = array(
    'url' => $url,
    'link_title' => $node->title,
    'weight' => 0,
  );

  // Wrap $link as the [0] element of a trivial outer array.
  $node->vote_storylink = array(
    $link,
  );
}