Convert broken handlers to PSR0
parent
5128dcbbac
commit
e2daf79ce8
|
@ -39,7 +39,7 @@ function _views_create_plugin($type, $plugin_id, $definition) {
|
|||
* Instantiate and construct a new handler
|
||||
*/
|
||||
function _views_create_handler($definition, $type = 'handler', $handler_type = NULL) {
|
||||
if ($definition['plugin_id']) {
|
||||
if (!empty($definition['plugin_id'])) {
|
||||
$manager = views_get_plugin_manager($handler_type);
|
||||
$handler = $manager->createInstance($definition['plugin_id']);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ namespace Drupal\views\Plugins\views;
|
|||
|
||||
use Drupal\views\ViewsObject;
|
||||
use Drupal\Component\Plugin\PluginBase;
|
||||
use Drupal\views\Plugin\PluginInterface;
|
||||
|
||||
abstract class Plugin extends PluginBase {
|
||||
public function __construct(array $configuration, $plugin_id) {
|
||||
|
|
|
@ -93,32 +93,6 @@ class AreaPluginBase extends Handler {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A special handler to take the place of missing or broken handlers.
|
||||
*
|
||||
* @ingroup views_area_handlers
|
||||
*/
|
||||
class views_handler_area_broken extends AreaPluginBase {
|
||||
function ui_name($short = FALSE) {
|
||||
return t('Broken/missing handler');
|
||||
}
|
||||
|
||||
function ensure_my_table() { /* No table to ensure! */ }
|
||||
function query($group_by = FALSE) { /* No query to run */ }
|
||||
function render($empty = FALSE) { return ''; }
|
||||
function options_form(&$form, &$form_state) {
|
||||
$form['markup'] = array(
|
||||
'#prefix' => '<div class="form-item description">',
|
||||
'#value' => 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.'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the handler is considered 'broken'
|
||||
*/
|
||||
function broken() { return TRUE; }
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\views\Plugins\views\sort\Broken
|
||||
*/
|
||||
|
||||
namespace Drupal\views\Plugins\views\area;
|
||||
|
||||
use Drupal\Core\Annotation\Plugin;
|
||||
|
||||
/**
|
||||
* A special handler to take the place of missing or broken handlers.
|
||||
*
|
||||
* @ingroup views_area_handlers
|
||||
*/
|
||||
|
||||
/**
|
||||
* @Plugin(
|
||||
* plugin_id = "broken"
|
||||
* )
|
||||
*/
|
||||
class Broken extends AreaPluginBase {
|
||||
function ui_name($short = FALSE) {
|
||||
return t('Broken/missing handler');
|
||||
}
|
||||
|
||||
function ensure_my_table() { /* No table to ensure! */ }
|
||||
function query($group_by = FALSE) { /* No query to run */ }
|
||||
function render($empty = FALSE) { return ''; }
|
||||
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; }
|
||||
}
|
|
@ -1245,30 +1245,6 @@ class ArgumentPluginBase extends Handler {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* A special handler to take the place of missing or broken handlers.
|
||||
*
|
||||
* @ingroup views_argument_handlers
|
||||
*/
|
||||
class views_handler_argument_broken extends ArgumentPluginBase {
|
||||
function ui_name($short = FALSE) {
|
||||
return t('Broken/missing handler');
|
||||
}
|
||||
|
||||
function ensure_my_table() { /* No table to ensure! */ }
|
||||
function query($group_by = FALSE) { /* 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; }
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\views\Plugins\views\sort\Broken
|
||||
*/
|
||||
|
||||
namespace Drupal\views\Plugins\views\argument;
|
||||
|
||||
use Drupal\Core\Annotation\Plugin;
|
||||
|
||||
/**
|
||||
* A special handler to take the place of missing or broken handlers.
|
||||
*
|
||||
* @ingroup views_argument_handlers
|
||||
*/
|
||||
|
||||
/**
|
||||
* @Plugin(
|
||||
* plugin_id = "broken"
|
||||
* )
|
||||
*/
|
||||
class Broken extends ArgumentPluginBase {
|
||||
function ui_name($short = FALSE) {
|
||||
return t('Broken/missing handler');
|
||||
}
|
||||
|
||||
function ensure_my_table() { /* No table to ensure! */ }
|
||||
function query($group_by = FALSE) { /* 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; }
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\views\Plugins\views\sort\Broken
|
||||
*/
|
||||
|
||||
namespace Drupal\views\Plugins\views\field;
|
||||
|
||||
use Drupal\Core\Annotation\Plugin;
|
||||
|
||||
/**
|
||||
* A special handler to take the place of missing or broken handlers.
|
||||
*
|
||||
* @ingroup views_field_handlers
|
||||
*/
|
||||
|
||||
/**
|
||||
* @Plugin(
|
||||
* plugin_id = "broken"
|
||||
* )
|
||||
*/
|
||||
class Broken extends FieldPluginBase {
|
||||
function ui_name($short = FALSE) {
|
||||
return t('Broken/missing handler');
|
||||
}
|
||||
|
||||
function ensure_my_table() { /* No table to ensure! */ }
|
||||
function query($group_by = FALSE) { /* 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; }
|
||||
}
|
|
@ -1620,31 +1620,6 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* A special handler to take the place of missing or broken handlers.
|
||||
*
|
||||
* @ingroup views_field_handlers
|
||||
*/
|
||||
class views_handler_field_broken extends FieldPluginBase {
|
||||
function ui_name($short = FALSE) {
|
||||
return t('Broken/missing handler');
|
||||
}
|
||||
|
||||
function ensure_my_table() { /* No table to ensure! */ }
|
||||
function query($group_by = FALSE) { /* 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; }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\views\Plugins\views\sort\Broken
|
||||
*/
|
||||
|
||||
namespace Drupal\views\Plugins\views\filter;
|
||||
|
||||
use Drupal\Core\Annotation\Plugin;
|
||||
|
||||
/**
|
||||
* A special handler to take the place of missing or broken handlers.
|
||||
*
|
||||
* @ingroup views_filter_handlers
|
||||
*/
|
||||
|
||||
/**
|
||||
* @Plugin(
|
||||
* plugin_id = "broken"
|
||||
* )
|
||||
*/
|
||||
class Broken extends FilterPluginBase {
|
||||
function ui_name($short = FALSE) {
|
||||
return t('Broken/missing handler');
|
||||
}
|
||||
|
||||
function ensure_my_table() { /* No table to ensure! */ }
|
||||
function query($group_by = FALSE) { /* 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; }
|
||||
}
|
|
@ -718,32 +718,6 @@ class FilterPluginBase extends Handler {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A special handler to take the place of missing or broken handlers.
|
||||
*
|
||||
* @ingroup views_filter_handlers
|
||||
*/
|
||||
class views_handler_filter_broken extends FilterPluginBase {
|
||||
function ui_name($short = FALSE) {
|
||||
return t('Broken/missing handler');
|
||||
}
|
||||
|
||||
function ensure_my_table() { /* No table to ensure! */ }
|
||||
function query($group_by = FALSE) { /* 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; }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\views\Plugins\views\sort\Broken
|
||||
*/
|
||||
|
||||
namespace Drupal\views\Plugins\views\sort;
|
||||
|
||||
use Drupal\Core\Annotation\Plugin;
|
||||
|
||||
/**
|
||||
* A special handler to take the place of missing or broken handlers.
|
||||
*
|
||||
* @ingroup views_sort_handlers
|
||||
*/
|
||||
|
||||
/**
|
||||
* @Plugin(
|
||||
* plugin_id = "broken"
|
||||
* )
|
||||
*/
|
||||
class Broken extends SortPluginBase {
|
||||
function ui_name($short = FALSE) {
|
||||
return t('Broken/missing handler');
|
||||
}
|
||||
|
||||
function ensure_my_table() { /* No table to ensure! */ }
|
||||
function query($group_by = FALSE) { /* 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; }
|
||||
}
|
|
@ -222,37 +222,6 @@ class SortPluginBase extends Handler {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A special handler to take the place of missing or broken handlers.
|
||||
*
|
||||
* @ingroup views_sort_handlers
|
||||
*/
|
||||
|
||||
/**
|
||||
* @Plugin(
|
||||
* plugin_id = "broken"
|
||||
* )
|
||||
*/
|
||||
class views_handler_sort_broken extends SortPluginBase {
|
||||
function ui_name($short = FALSE) {
|
||||
return t('Broken/missing handler');
|
||||
}
|
||||
|
||||
function ensure_my_table() { /* No table to ensure! */ }
|
||||
function query($group_by = FALSE) { /* 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; }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
20
views.module
20
views.module
|
@ -1273,13 +1273,10 @@ function views_get_handler($table, $field, $key, $override = NULL) {
|
|||
return $handler;
|
||||
}
|
||||
|
||||
// Set up a default handler:
|
||||
if (empty($data[$field][$key]['handler'])) {
|
||||
$data[$field][$key]['handler'] = 'views_handler_' . $key;
|
||||
}
|
||||
|
||||
if ($override) {
|
||||
$data[$field][$key]['override handler'] = $override;
|
||||
// @fixme: temporary.
|
||||
// Set up a default handler, if both handler and plugin_id is not specified.
|
||||
if (empty($data[$field][$key]['handler']) && empty($data[$field][$key]['plugin_id'])) {
|
||||
$data[$field][$key]['plugin_id'] = 'standard';
|
||||
}
|
||||
|
||||
$handler = _views_prepare_handler($data[$field][$key], $data, $field, $key);
|
||||
|
@ -1293,7 +1290,7 @@ function views_get_handler($table, $field, $key, $override = NULL) {
|
|||
vpr("Missing handler: @table @field @key", array('@table' => $table, '@field' => $field, '@key' => $key));
|
||||
$broken = array(
|
||||
'title' => t('Broken handler @table.@field', array('@table' => $table, '@field' => $field)),
|
||||
'handler' => 'views_handler_' . $key . '_broken',
|
||||
'plugin_id' => 'broken',
|
||||
'table' => $table,
|
||||
'field' => $field,
|
||||
);
|
||||
|
@ -1416,8 +1413,13 @@ function views_get_plugin_manager($type) {
|
|||
case 'localization':
|
||||
$manager = new LocalizationPluginManager();
|
||||
break;
|
||||
case 'field':
|
||||
case 'filter':
|
||||
case 'argument':
|
||||
case 'area':
|
||||
case 'sort':
|
||||
$manager = new HandlerPluginManager('sort');
|
||||
case 'relationship':
|
||||
$manager = new HandlerPluginManager($type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue