Commit 6efde1f2 authored by dawehner's avatar dawehner Committed by tim.plunkett

Issue #1778768 by aspilicious, dawehner: Fixed Create a node_language() argument plugin.

parent 541dd42e
<?php
/**
* @file
* Definition of Views\taxonomy\Plugin\views\field\Language.
*/
namespace Views\taxonomy\Plugin\views\field;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to show the language of a taxonomy term.
*
* @Plugin(
* id = "taxonomy_term_language"
* )
*/
class Language extends Taxonomy {
/**
* Overrides Views\taxonomy\Plugin\views\field\Taxonomy::render().
*/
public function render($values) {
$value = $this->get_value($values);
$language = language_load($value);
$value = $language ? $language->name : '';
return $this->render_link($this->sanitizeValue($value), $values);
}
}
......@@ -14,6 +14,8 @@
* Field handler to provide simple renderer that allows linking to a taxonomy
* term.
*
* @todo This handler should use entities directly.
*
* @ingroup views_field_handlers
*
* @Plugin(
......
......@@ -171,14 +171,14 @@ function comment_views_data() {
'title' => t('Language'),
'help' => t('The language the comment is in.'),
'field' => array(
'id' => 'locale_language',
'id' => 'language',
'click sortable' => TRUE,
),
'filter' => array(
'id' => 'locale_language',
'id' => 'language',
),
'argument' => array(
'id' => 'locale_language',
'id' => 'language',
),
'sort' => array(
'id' => 'standard',
......
......@@ -252,6 +252,24 @@ function taxonomy_views_data() {
),
);
$data['taxonomy_term_data']['langcode'] = array(
'title' => t('Language'), // The item it appears as on the UI,
'help' => t('Language of the term'),
'field' => array(
'id' => 'taxonomy_term_language',
'click sortable' => TRUE,
),
'sort' => array(
'id' => 'standard',
),
'filter' => array(
'id' => 'language',
),
'argument' => array(
'id' => 'language',
),
);
// Link to edit the term
$data['taxonomy_term_data']['edit_term'] = array(
'field' => array(
......
......@@ -162,10 +162,10 @@ function user_views_data() {
'id' => 'standard',
),
'filter' => array(
'id' => 'node_language',
'id' => 'language',
),
'argument' => array(
'id' => 'node_language',
'id' => 'language',
),
);
......
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