Clean up last few handlers and plugins.

8.0.x
Tim Plunkett 2012-07-30 20:39:33 -04:00
parent 454a6e9fed
commit 3b2195d996
11 changed files with 63 additions and 44 deletions

View File

@ -0,0 +1,43 @@
<?php
/**
* @file
* Definition of Drupal\views\Plugin\views\relationship\Broken.
*/
namespace Drupal\views\Plugin\views\relationship;
use Drupal\views\Plugin\views\Handler;
use Drupal\Core\Annotation\Plugin;
/**
* A special handler to take the place of missing or broken handlers.
*
* @ingroup views_relationship_handlers
*/
/**
* @Plugin(
* plugin_id = "broken"
* )
*/
class Broken extends RelationshipPluginBase {
function ui_name($short = FALSE) {
return t('Broken/missing handler');
}
function ensure_my_table() { /* No table to ensure! */ }
function query() { /* No query to run */ }
function options_form(&$form, &$form_state) {
$form['markup'] = array(
'#markup' => '<div class="form-item description">' . t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.') . '</div>',
);
}
/**
* Determine if the handler is considered 'broken'
*/
function broken() { return TRUE; }
}

View File

@ -169,30 +169,6 @@ class RelationshipPluginBase extends Handler {
}
}
/**
* A special handler to take the place of missing or broken handlers.
*
* @ingroup views_relationship_handlers
*/
class views_handler_relationship_broken extends RelationshipPluginBase {
function ui_name($short = FALSE) {
return t('Broken/missing handler');
}
function ensure_my_table() { /* No table to ensure! */ }
function query() { /* No query to run */ }
function options_form(&$form, &$form_state) {
$form['markup'] = array(
'#markup' => '<div class="form-item description">' . t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.') . '</div>',
);
}
/**
* Determine if the handler is considered 'broken'
*/
function broken() { return TRUE; }
}
/**
* @}
*/

View File

@ -670,10 +670,10 @@ abstract class WizardPluginBase implements WizardInterface {
}
}
$table_data = views_fetch_data($table);
// Check whether the bundle key filter handler is or an child of it views_handler_filter_in_operator
// Check whether the bundle key filter handler is or an child of it in_operator
// If it's not just use a single value instead of an array.
$handler = $table_data[$bundle_key]['filter']['handler'];
if ($handler == 'views_handler_filter_in_operator' || is_subclass_of($handler, 'views_handler_filter_in_operator')) {
$handler = $table_data[$bundle_key]['filter']['plugin_id'];
if ($handler == 'in_operator' || is_subclass_of($handler, 'in_operator')) {
$value = drupal_map_assoc(array($form_state['values']['show']['type']));
}
else {

View File

@ -10,20 +10,20 @@ namespace Drupal\views\Tests\Handler;
use Drupal\views\Tests\ViewsSqlTest;
/**
* Tests the core views_handler_filter_in_operator handler.
* Tests the core in_operator handler.
*/
class FilterInOperatorTest extends ViewsSqlTest {
public static function getInfo() {
return array(
'name' => 'Filter: in_operator',
'description' => 'Test the core views_handler_filter_in_operator handler.',
'description' => 'Test the core in_operator handler.',
'group' => 'Views Handlers',
);
}
function viewsData() {
$data = parent::viewsData();
$data['views_test']['age']['filter']['handler'] = 'views_handler_filter_in_operator';
$data['views_test']['age']['filter']['handler'] = 'in_operator';
return $data;
}

View File

@ -18,7 +18,7 @@ use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
*
* @Plugin(
* plugin_id = "current_user",
* title = @Translation("User ID from logged in user"),
* title = @Translation("User ID from logged in user")
* )
*/
class CurrentUser extends ArgumentDefaultPluginBase {

View File

@ -16,7 +16,7 @@ use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
*
* @Plugin(
* plugin_id = "user",
* title = @Translation("User ID from URL"),
* title = @Translation("User ID from URL")
* )
*/
class User extends ArgumentDefaultPluginBase {

View File

@ -20,7 +20,7 @@ use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
*
* @Plugin(
* plugin_id = "user",
* title = @Translation("User"),
* title = @Translation("User")
* )
*/
class User extends ArgumentValidatorPluginBase {

View File

@ -213,7 +213,7 @@ function comment_views_data() {
'help' => t('Date in the form of CCYYMMDD.'),
'argument' => array(
'field' => 'changed',
'handler' => 'views_handler_argument_node_created_fulldate',
'plugin_id' => 'node_created_fulldate',
),
);
@ -223,7 +223,7 @@ function comment_views_data() {
'help' => t('Date in the form of YYYYMM.'),
'argument' => array(
'field' => 'changed',
'handler' => 'views_handler_argument_node_created_year_month',
'plugin_id' => 'node_created_year_month',
),
);
@ -233,7 +233,7 @@ function comment_views_data() {
'help' => t('Date in the form of YYYY.'),
'argument' => array(
'field' => 'changed',
'handler' => 'views_handler_argument_node_created_year',
'plugin_id' => 'node_created_year',
),
);
@ -243,7 +243,7 @@ function comment_views_data() {
'help' => t('Date in the form of MM (01 - 12).'),
'argument' => array(
'field' => 'changed',
'handler' => 'views_handler_argument_node_created_month',
'plugin_id' => 'node_created_month',
),
);
@ -253,7 +253,7 @@ function comment_views_data() {
'help' => t('Date in the form of DD (01 - 31).'),
'argument' => array(
'field' => 'changed',
'handler' => 'views_handler_argument_node_created_day',
'plugin_id' => 'node_created_day',
),
);
@ -263,7 +263,7 @@ function comment_views_data() {
'help' => t('Date in the form of WW (01 - 53).'),
'argument' => array(
'field' => 'changed',
'handler' => 'views_handler_argument_node_created_week',
'plugin_id' => 'node_created_week',
),
);
@ -387,7 +387,7 @@ function comment_views_data() {
'plugin_id' => 'numeric',
),
'field' => array(
'handler' => 'views_handler_field_user',
'plugin_id' => 'user',
),
);

View File

@ -50,7 +50,7 @@ function file_field_views_data_views_data_alter(&$data, $field) {
$data['file_managed'][$pseudo_field_name]['relationship'] = array(
'title' => t('@entity using @field', array('@entity' => $entity, '@field' => $label)),
'help' => t('Relate each @entity with a @field set to the file.', array('@entity' => $entity, '@field' => $label)),
'handler' => 'views_handler_relationship_entity_reverse',
'plugin_id' => 'entity_reverse',
'field_name' => $field['field_name'],
'field table' => _field_sql_storage_tablename($field),
'field field' => $field['field_name'] . '_fid',

View File

@ -49,7 +49,7 @@ function image_field_views_data_views_data_alter(&$data, $field) {
$data['file_managed'][$pseudo_field_name]['relationship'] = array(
'title' => t('@entity using @field', array('@entity' => $entity, '@field' => $label)),
'help' => t('Relate each @entity with a @field set to the image.', array('@entity' => $entity, '@field' => $label)),
'handler' => 'views_handler_relationship_entity_reverse',
'plugin_id' => 'entity_reverse',
'field_name' => $field['field_name'],
'field table' => _field_sql_storage_tablename($field),
'field field' => $field['field_name'] . '_fid',

View File

@ -146,7 +146,7 @@ function statistics_views_data() {
'help' => t('Title of page visited.'),
'field' => array(
'handler' => 'views_handler_field_accesslog_path',
'plugin_id' => 'statistics_accesslog_path',
'click sortable' => TRUE,
),
'filter' => array(
@ -166,7 +166,7 @@ function statistics_views_data() {
'help' => t('Internal path to page visited (relative to Drupal root.)'),
'field' => array(
'handler' => 'views_handler_field_accesslog_path',
'plugin_id' => 'statistics_accesslog_path',
'click sortable' => TRUE,
),
'filter' => array(