You are here

function yoast_seo_get_score in Real-time SEO for Drupal 7

Custom function which will get the SEO score from a nid.

Parameters

int $entity_id: The entity id of the score we need to load.

Return value

int An int representing the SEO score.

2 calls to yoast_seo_get_score()
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 511
Primary hook implementations for Yoast SEO for Drupal module.

Code

function yoast_seo_get_score($entity_id) {

  // Get the SEO score for this entity.
  $result = db_select('yoast_seo', 'y')
    ->fields('y', array(
    'seo_status',
  ))
    ->condition('y.entity_id', $entity_id)
    ->execute()
    ->fetchAssoc();
  return !empty($result['seo_status']) ? $result['seo_status'] : '0';
}