Commit 8f667fa8 authored by Homotechsual's avatar Homotechsual Committed by Robert Ragas

Issue #2784549 by Homotechsual: Views Improvements

parent b2351c58
......@@ -10,11 +10,66 @@
*/
function yoast_seo_views_data() {
$data = array();
$data['node']['yoast_seo_score'] = array(
'title' => t('SEO score'),
'help' => t('SEO score'),
'field' => array(
'handler' => 'yoast_seo_handler_score',
$data['yoast_seo'] = array(
'table' => array(
'group' => t('Yoast SEO'),
'base' => array(
'field' => 'entity_id',
'title' => t('Entity ID'),
'help' => t('The Entity ID the Yoast SEO data is attached to.'),
),
'join' => array(
'node' => array(
'left_field' => 'nid',
'field' => 'entity_id',
),
),
),
'entity_id' => array(
'title' => t('Entity ID'),
'help' => t('The Entity ID the Yoast SEO data is attached to.'),
'relationship' => array(
'base' => 'node',
'field' => 'nid',
'handler' => 'views_handler_relationship',
'label' => t('Node'),
),
),
'focus_keyword' => array(
'title' => t('Focus Keyword'),
'help' => t('The focus keyword for the entity'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
),
'seo_status' => array(
'title' => t('SEO Score'),
'help' => t('Yoast SEO Score represented as a numeric value.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
),
'seo_rating' => array(
'title' => t('SEO Rating'),
'help' => t('Yoast SEO Rating represented using a traffic light system.'),
'field' => array(
'handler' => 'yoast_seo_handler_rating',
),
),
);
return $data;
......
<?php
class yoast_seo_handler_score extends views_handler_field {
class yoast_seo_handler_rating extends views_handler_field {
/**
* @inheritdoc
*/
......
......@@ -14,4 +14,4 @@ dependencies[] = metatag (>= 1.7)
configure = admin/config/search/yoast
; Views Handlers.
files[] = views/yoast_seo_handler_score.inc
files[] = views/yoast_seo_handler_rating.inc
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment