You are here

function yoast_seo_score_rating in Real-time SEO for Drupal 7

Custom function to build up score div, same as in scoreToRating.js.

Parameters

int $score: The score of the node.

Return value

string A string that we can use as classname and automatically will be styled.

3 calls to yoast_seo_score_rating()
yoast_seo_configuration_form_after_build in ./yoast_seo.module
In this afterbuild function we add the configuration to the JavaScript.
yoast_seo_form_node_admin_content_alter in ./yoast_seo.module
Implements hook_form_FORM_ID_alter().
yoast_seo_handler_rating::render in views/yoast_seo_handler_rating.inc
Renders the field handler.

File

./yoast_seo.module, line 533
Primary hook implementations for Yoast SEO for Drupal module.

Code

function yoast_seo_score_rating($score) {
  $score_rate = '';
  if ($score <= 4) {
    $score_rate = "bad";
  }
  if ($score > 4 && $score <= 7) {
    $score_rate = "ok";
  }
  if ($score > 7) {
    $score_rate = "good";
  }
  if ($score == 0) {
    $score_rate = "na";
  }
  return $score_rate;
}