You are here

protected function RateDefaultWidget::getDescription in Rate 7.2

Get description for this widget.

Return value

string

1 call to RateDefaultWidget::getDescription()
RateDefaultWidget::init in classes/default.inc
Initialize the widget.

File

classes/default.inc, line 213

Class

RateDefaultWidget

Code

protected function getDescription() {
  $user_vote = NULL;
  foreach ($this->results as $result) {
    if ($result['function'] == 'user') {
      $user_vote = $this
        ->getButtonLabelByValue($result['value']);
    }
  }
  if ($this->count == 0) {
    $description = $this->desc_norating;
  }
  elseif (is_null($user_vote)) {
    $description = $this->desc_notvoted;
  }
  elseif ($this->just_voted) {
    $description = $this->desc_justvoted;
  }
  else {
    $description = $this->desc_voted;
  }
  $description = t($description, array(
    '@rating' => $this->rating,
    '@vote' => $user_vote,
  ));
  $description = "<span class=\"rate-description\">{$description}</span>";
  return $description;
}