You are here

function theme_uniqueness_widget in Uniqueness 7

Same name and namespace in other branches
  1. 6 uniqueness.module \theme_uniqueness_widget()

Theme function for the Uniqueness widget.

Note, some classes are required in the widget markup for Uniqueness to work. These classes begin with the appropriate word, 'uniquness'. Do not remove, or be sure to add them to your own theme override function.

1 theme call to theme_uniqueness_widget()
uniqueness_widget_content in ./uniqueness.module
Returns the rendered related content.

File

./uniqueness.module, line 566
uniqueness.module

Code

function theme_uniqueness_widget($variables) {
  $description = $variables['description'];
  $results = $variables['results'];

  // The widget title is populated by the block or in the form, if enabled.
  $output = '';

  // Add the Uniqueness description, if set.
  if (!empty($description)) {
    $output .= '<p class="uniqueness-description">' . $description . '</p>';
  }

  // A parent block element with class uniqueness-dyn is required.
  $output .= '<div class="uniqueness-dyn">';

  // An element with class uniqueness-search-notifier is also required but feel
  // free to alter the element or add additional markup. The element's content
  // is dynamically filled by Javascript.
  $output .= '<span class="uniqueness-search-notifier"></span>';

  // If $results is populated than either an existing page is being edited or
  // the page is being previewed.
  if (empty($results)) {

    // Same markup as theme_item_list, if it were to return a <ul></ul> for an
    // empty array
    $output .= '<div class="item-list"><ul></ul></div>';
  }
  else {

    // Run through theme_item_list() or overrides.
    $output .= theme('item_list', array(
      'items' => $results,
    ));
  }

  // Close parent block element.
  $output .= '</div>';
  return $output;
}