You are here

function _oembedprovider_node_provider in oEmbed 6.0

The default provider to handle nodes

Parameters

string $url:

array $matches:

1 call to _oembedprovider_node_provider()
oembedprovider_node_provider in ./oembedprovider.module
The default provider to handle nodes

File

./oembedprovider.inc, line 99
Functions for the oEmbed provider

Code

function _oembedprovider_node_provider($provider, $url, $matches) {
  static $block_endless_recursion = array();
  $result = FALSE;
  $nid = $matches[1];
  if (!isset($block_endless_recursion[$nid])) {
    $block_endless_recursion[$nid] = TRUE;
    $node = node_load($nid);
    if ($node && node_access('view', $node, drupal_anonymous_user())) {
      $author = user_load(array(
        'uid' => $node->uid,
      ));

      //TODO: The title and author data is currently returned as part of the rich-text html as well - this makes some clients show duplicate title and/or author information
      $result = _oembedprovider_result('rich', array(
        'html' => theme('oembed_node', $node),
        'title' => $node->title,
        'author_name' => $author->name,
        'author_url' => url('user/' . $author->uid, array(
          'absolute' => TRUE,
        )),
      ));
    }
    unset($block_endless_recursion[$nid]);
  }
  return $result;
}