Issue #1783018 by dawehner: Fixed some of locale.views.inc and remove textgroup support.
parent
771925c28a
commit
7c94e4893d
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of views_handler_argument_locale_group.
|
||||
*/
|
||||
|
||||
namespace Views\locale\Plugin\views\argument;
|
||||
|
||||
use Drupal\views\Plugin\views\argument\ArgumentPluginBase;
|
||||
use Drupal\Core\Annotation\Plugin;
|
||||
|
||||
/**
|
||||
* Argument handler to accept a language.
|
||||
*
|
||||
* @ingroup views_argument_handlers
|
||||
*
|
||||
* @Plugin(
|
||||
* id = "locale_group",
|
||||
* module = "locale"
|
||||
* )
|
||||
*/
|
||||
class Group extends ArgumentPluginBase {
|
||||
|
||||
public function construct() {
|
||||
parent::construct('group');
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the behavior of summary_name(). Get the user friendly version
|
||||
* of the group.
|
||||
*/
|
||||
function summary_name($data) {
|
||||
return $this->locale_group($data->{$this->name_alias});
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the behavior of title(). Get the user friendly version
|
||||
* of the language.
|
||||
*/
|
||||
function title() {
|
||||
return $this->locale_group($this->argument);
|
||||
}
|
||||
|
||||
function locale_group($group) {
|
||||
$groups = module_invoke_all('locale', 'groups');
|
||||
// Sort the list.
|
||||
asort($groups);
|
||||
return isset($groups[$group]) ? $groups[$group] : t('Unknown group');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of views_handler_field_locale_group.
|
||||
*/
|
||||
|
||||
namespace Views\locale\Plugin\views\field;
|
||||
|
||||
use Drupal\views\Plugin\views\field\FieldPluginBase;
|
||||
use Drupal\Core\Annotation\Plugin;
|
||||
|
||||
/**
|
||||
* Field handler to translate a group into its readable form.
|
||||
*
|
||||
* @ingroup views_field_handlers
|
||||
*
|
||||
* @Plugin(
|
||||
* id = "locale_group",
|
||||
* module = "locale"
|
||||
* )
|
||||
*/
|
||||
class Group extends FieldPluginBase {
|
||||
|
||||
function render($values) {
|
||||
$groups = module_invoke_all('locale', 'groups');
|
||||
// Sort the list.
|
||||
asort($groups);
|
||||
$value = $this->get_value($values);
|
||||
return isset($groups[$value]) ? $groups[$value] : '';
|
||||
}
|
||||
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of views_handler_filter_locale_group.
|
||||
*/
|
||||
|
||||
namespace Views\locale\Plugin\views\filter;
|
||||
|
||||
use Drupal\Core\Annotation\Plugin;
|
||||
use Drupal\views\Plugin\views\filter\InOperator;
|
||||
|
||||
/**
|
||||
* Filter by locale group.
|
||||
*
|
||||
* @ingroup views_filter_handlers
|
||||
*
|
||||
* @Plugin(
|
||||
* id = "locale_group",
|
||||
* module = "locale"
|
||||
* )
|
||||
*/
|
||||
class Group extends InOperator {
|
||||
|
||||
function get_value_options() {
|
||||
if (!isset($this->value_options)) {
|
||||
$this->value_title = t('Group');
|
||||
$groups = module_invoke_all('locale', 'groups');
|
||||
// Sort the list.
|
||||
asort($groups);
|
||||
$this->value_options = $groups;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -64,23 +64,6 @@ function locale_views_data() {
|
|||
),
|
||||
);
|
||||
|
||||
// Group field
|
||||
$data['locales_source']['textgroup'] = array(
|
||||
'group' => t('Locale source'),
|
||||
'title' => t('Group'),
|
||||
'help' => t('The group the translation is in.'),
|
||||
'field' => array(
|
||||
'id' => 'locale_group',
|
||||
'click sortable' => TRUE,
|
||||
),
|
||||
'filter' => array(
|
||||
'id' => 'locale_group',
|
||||
),
|
||||
'argument' => array(
|
||||
'id' => 'locale_group',
|
||||
),
|
||||
);
|
||||
|
||||
// Source field
|
||||
$data['locales_source']['source'] = array(
|
||||
'group' => t('Locale source'),
|
||||
|
@ -94,6 +77,19 @@ function locale_views_data() {
|
|||
),
|
||||
);
|
||||
|
||||
// Source field
|
||||
$data['locales_source']['context'] = array(
|
||||
'group' => t('Locale source'),
|
||||
'title' => t('Context'),
|
||||
'help' => t('The context this string applies to.'),
|
||||
'field' => array(
|
||||
'id' => 'standard',
|
||||
),
|
||||
'filter' => array(
|
||||
'id' => 'string',
|
||||
),
|
||||
);
|
||||
|
||||
// Version field
|
||||
$data['locales_source']['version'] = array(
|
||||
'group' => t('Locale source'),
|
||||
|
|
Loading…
Reference in New Issue