Commit 20edb75f authored by dawehner's avatar dawehner Committed by tim.plunkett

converted locale to plugins

parent 17fa51d0
......@@ -87,8 +87,6 @@ function _views_data_process_entity_types(&$data) {
* Fetch the plugin data from cache.
*/
function _views_fetch_plugin_data($type = NULL, $plugin_id = NULL, $reset = FALSE) {
$manager = views_get_plugin_manager($type);
if (!$type && !$plugin_id) {
$plugins = array();
$plugin_types = array('access', 'argument_default', 'argument_validator', 'cache', 'display_extender', 'display', 'exposed_form', 'localization', 'pager', 'query', 'row', 'style', 'wizard');
......@@ -99,6 +97,8 @@ function _views_fetch_plugin_data($type = NULL, $plugin_id = NULL, $reset = FALS
return $plugins;
}
$manager = views_get_plugin_manager($type);
if (!$plugin_id) {
return $manager->getDefinitions();
}
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_argument_locale_group.
*/
namespace Drupal\locale\Plugin\views\argument;
use Drupal\views\Plugins\views\argument\ArgumentPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Argument handler to accept a language.
*
* @ingroup views_argument_handlers
*/
class views_handler_argument_locale_group extends views_handler_argument {
/**
* @Plugin(
* plugin_id = "locale_group"
* )
*/
class Group extends ArgumentPluginBase {
function construct() {
parent::construct('group');
}
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_argument_locale_language.
*/
namespace Drupal\locale\Plugin\views\argument;
use Drupal\views\Plugins\views\argument\ArgumentPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Argument handler to accept a language.
*
* @ingroup views_argument_handlers
*/
class views_handler_argument_locale_language extends views_handler_argument {
/**
* @Plugin(
* plugin_id = "locale_language"
* )
*/
class Language extends ArgumentPluginBase {
function construct() {
parent::construct('language');
}
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_field_locale_group.
*/
namespace Drupal\locale\Plugin\views\field;
use Drupal\views\Plugins\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to translate a group into its readable form.
*
* @ingroup views_field_handlers
*/
class views_handler_field_locale_group extends views_handler_field {
/**
* @Plugin(
* plugin_id = "locale_group"
* )
*/
class Group extends FieldPluginBase {
function render($values) {
$groups = module_invoke_all('locale', 'groups');
// Sort the list.
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_field_locale_language.
*/
namespace Drupal\locale\Plugin\views\field;
use Drupal\views\Plugins\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to translate a language into its readable form.
*
* @ingroup views_field_handlers
*/
class views_handler_field_locale_language extends views_handler_field {
/**
* @Plugin(
* plugin_id = "locale_language"
* )
*/
class Language extends FieldPluginBase {
function option_definition() {
$options = parent::option_definition();
$options['native_language'] = array('default' => FALSE, 'bool' => TRUE);
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_field_locale_link_edit.
*/
namespace Drupal\locale\Plugin\views\field;
use Drupal\views\Plugins\views\field\FieldPluginBase;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to present a link to edit a translation.
*
* @ingroup views_field_handlers
*/
class views_handler_field_locale_link_edit extends views_handler_field {
/**
* @Plugin(
* plugin_id = "locale_link_edit"
* )
*/
class LinkEdit extends FieldPluginBase {
function construct() {
parent::construct();
$this->additional_fields['lid'] = 'lid';
......
......@@ -5,12 +5,23 @@
* Definition of views_handler_field_node_language.
*/
namespace Drupal\locale\Plugin\views\field;
use Drupal\node\Plugin\views\field\Node;
use Drupal\Core\Annotation\Plugin;
/**
* Field handler to translate a language into its readable form.
*
* @ingroup views_field_handlers
*/
class views_handler_field_node_language extends views_handler_field_node {
/**
* @Plugin(
* plugin_id = "node_language"
* )
*/
class NodeLanguage extends Node {
function option_definition() {
$options = parent::option_definition();
$options['native_language'] = array('default' => FALSE, 'bool' => TRUE);
......
......@@ -5,6 +5,9 @@
* Definition of views_handler_filter_locale_group.
*/
namespace Drupal\locale\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\Plugins\views\filter\InOperator;
/**
......@@ -12,7 +15,13 @@
*
* @ingroup views_filter_handlers
*/
class views_handler_filter_locale_group extends InOperator {
/**
* @Plugin(
* plugin_id = "locale_group"
* )
*/
class Group extends InOperator {
function get_value_options() {
if (!isset($this->value_options)) {
$this->value_title = t('Group');
......
......@@ -5,6 +5,9 @@
* Definition of views_handler_filter_locale_language.
*/
namespace Drupal\locale\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\Plugins\views\filter\InOperator;
/**
......@@ -12,7 +15,7 @@
*
* @ingroup views_filter_handlers
*/
class views_handler_filter_locale_language extends InOperator {
class Language extends InOperator {
function get_value_options() {
if (!isset($this->value_options)) {
$this->value_title = t('Language');
......
......@@ -5,6 +5,9 @@
* Definition of views_handler_filter_node_language.
*/
namespace Drupal\locale\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\Plugins\views\filter\InOperator;
/**
......@@ -12,7 +15,13 @@
*
* @ingroup views_filter_handlers
*/
class views_handler_filter_node_language extends InOperator {
/**
* @Plugin(
* plugin_id = "node_language"
* )
*/
class NodeLanguage extends InOperator {
function get_value_options() {
if (!isset($this->value_options)) {
$this->value_title = t('Language');
......
......@@ -5,6 +5,9 @@
* Definition of views_handler_filter_locale_version.
*/
namespace Drupal\locale\Plugin\views\filter;
use Drupal\Core\Annotation\Plugin;
use Drupal\views\Plugins\views\filter\InOperator;
/**
......@@ -12,7 +15,13 @@
*
* @ingroup views_filter_handlers
*/
class views_handler_filter_locale_version extends InOperator {
/**
* @Plugin(
* plugin_id = "locale_version"
* )
*/
class Version extends InOperator {
function get_value_options() {
if (!isset($this->value_options)) {
$this->value_title = t('Version');
......
......@@ -175,14 +175,14 @@ function comment_views_data() {
'title' => t('Language'),
'help' => t('The language the comment is in.'),
'field' => array(
'handler' => 'views_handler_field_locale_language',
'plugin_id' => 'locale_language',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_locale_language',
'plugin_id' => 'locale_language',
),
'argument' => array(
'handler' => 'views_handler_argument_locale_language',
'plugin_id' => 'locale_language',
),
'sort' => array(
'plugin_id' => 'standard',
......
......@@ -70,14 +70,14 @@ function locale_views_data() {
'title' => t('Group'),
'help' => t('The group the translation is in.'),
'field' => array(
'handler' => 'views_handler_field_locale_group',
'plugin_id' => 'locale_group',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_locale_group',
'plugin_id' => 'locale_group',
),
'argument' => array(
'handler' => 'views_handler_argument_locale_group',
'plugin_id' => 'locale_group',
),
);
......@@ -104,7 +104,7 @@ function locale_views_data() {
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_locale_version',
'plugin_id' => 'locale_version',
),
'argument' => array(
'plugin_id' => 'string',
......@@ -116,7 +116,7 @@ function locale_views_data() {
'field' => array(
'title' => t('Edit link'),
'help' => t('Provide a simple link to edit the translations.'),
'handler' => 'views_handler_field_locale_link_edit',
'plugin_id' => 'locale_link_edit',
),
);
......@@ -154,14 +154,14 @@ function locale_views_data() {
'title' => t('Language'),
'help' => t('The language this translation is in.'),
'field' => array(
'handler' => 'views_handler_field_locale_language',
'plugin_id' => 'locale_language',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_locale_language',
'plugin_id' => 'locale_language',
),
'argument' => array(
'handler' => 'views_handler_argument_locale_language',
'plugin_id' => 'locale_language',
),
);
......@@ -205,14 +205,14 @@ function locale_views_data_alter(&$data) {
'title' => t('Language'),
'help' => t('The language the content is in.'),
'field' => array(
'handler' => 'views_handler_field_node_language',
'plugin_id' => 'node_language',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_node_language',
'plugin_id' => 'node_language',
),
'argument' => array(
'handler' => 'views_handler_argument_node_language',
'plugin_id' => 'node_language',
),
'sort' => array(
'plugin_id' => 'standard',
......
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