Commit 5c615e69 authored by idebr's avatar idebr Committed by Berdir

Issue #2912784 by idebr, karenann: Creating a new view for Redirects results...

Issue #2912784 by idebr, karenann: Creating a new view for Redirects results in a broken/missing fields handler
parent 8944469c
......@@ -24,7 +24,7 @@ use Drupal\link\LinkItemInterface;
* "delete" = "Drupal\redirect\Form\RedirectDeleteForm",
* "edit" = "Drupal\redirect\Form\RedirectForm"
* },
* "views_data" = "Drupal\views\EntityViewsData",
* "views_data" = "Drupal\redirect\RedirectViewsData",
* "storage_schema" = "\Drupal\redirect\RedirectStorageSchema"
* },
* base_table = "redirect",
......
<?php
namespace Drupal\redirect;
use Drupal\views\EntityViewsData;
/**
* Provides views integration for Redirect entities.
*/
class RedirectViewsData extends EntityViewsData {
/**
* {@inheritdoc}
*/
public function getViewsData() {
$data = parent::getViewsData();
// Views defaults to the 'redirect_source' field that is configured as
// the redirect label. Since this is a composed field, change the default
// field to its 'path' value.
$data['redirect']['table']['base']['defaults']['field'] = 'redirect_source__path';
return $data;
}
}
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