You are here

function uniqueness_widget_content in Uniqueness 6

Same name and namespace in other branches
  1. 7 uniqueness.module \uniqueness_widget_content()

Content of our block.

2 calls to uniqueness_widget_content()
uniqueness_block in ./uniqueness.module
Implementation of hook_block().
uniqueness_form_alter in ./uniqueness.module
Implementation of hook_form_alter().

File

./uniqueness.module, line 295
uniqueness.module

Code

function uniqueness_widget_content() {
  $results = array();
  $description = filter_xss_admin(variable_get('uniqueness_default_description', t("Help us increase the signal to noise ratio! If we find content that's related or similar to what you're posting it will be listed here.")));

  // If we have stored values we're previewing the post.
  $values = _uniqueness_store();
  if (!empty($values)) {
    $content = uniqueness_content($values);
    $items = array();
    foreach ($content as $nid => $item) {

      // Avoid duplicates.
      if (!in_array($nid, array_keys($items))) {
        $items[$nid] = $item;
        $options = array(
          'attributes' => array(
            'target' => '_blank',
          ),
        );
        $results[] = l($item['title'], 'node/' . $item['nid'], $options);
      }
    }
  }

  // Pass the description and any preview results through the theme system.
  return theme('uniqueness_widget', $description, $results);
}