diff --git a/includes/handlers.inc b/includes/handlers.inc index 3bc656f17aaa92bd6f67f489b5c261791c206f7a..749d4a81924524d689ba70fc141bfe3fae26c48f 100644 --- a/includes/handlers.inc +++ b/includes/handlers.inc @@ -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']); } diff --git a/lib/Drupal/views/Plugins/views/Plugin.php b/lib/Drupal/views/Plugins/views/Plugin.php index f19a74ddfae02873139f519c4fa7c08c38b93825..60a9c9a7aa0e23cb81af8fccc7574780045c2dd5 100644 --- a/lib/Drupal/views/Plugins/views/Plugin.php +++ b/lib/Drupal/views/Plugins/views/Plugin.php @@ -9,7 +9,6 @@ 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) { diff --git a/lib/Drupal/views/Plugins/views/area/AreaPluginBase.php b/lib/Drupal/views/Plugins/views/area/AreaPluginBase.php index 20c1929b734005cf4d9cd9f6b02c9d1fe973bb77..044fc5e9df4a61de6021f7a6f705fd11dac19c31 100644 --- a/lib/Drupal/views/Plugins/views/area/AreaPluginBase.php +++ b/lib/Drupal/views/Plugins/views/area/AreaPluginBase.php @@ -93,32 +93,6 @@ function use_group_by() { } } -/** - * 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; } -} - /** * @} */ diff --git a/lib/Drupal/views/Plugins/views/area/Broken.php b/lib/Drupal/views/Plugins/views/area/Broken.php new file mode 100644 index 0000000000000000000000000000000000000000..20ce56c62661cb815f4a594135a4e2c654f20456 --- /dev/null +++ b/lib/Drupal/views/Plugins/views/area/Broken.php @@ -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; } +} diff --git a/lib/Drupal/views/Plugins/views/argument/ArgumentPluginBase.php b/lib/Drupal/views/Plugins/views/argument/ArgumentPluginBase.php index 570cbe12dea2b3144719aae72c4a2aead2076962..41662bf28f6869d20483ad10232ee1d5c18edd80 100644 --- a/lib/Drupal/views/Plugins/views/argument/ArgumentPluginBase.php +++ b/lib/Drupal/views/Plugins/views/argument/ArgumentPluginBase.php @@ -1245,30 +1245,6 @@ function get_sort_name() { } -/** - * 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; } -} - /** * @} */ diff --git a/lib/Drupal/views/Plugins/views/argument/Broken.php b/lib/Drupal/views/Plugins/views/argument/Broken.php new file mode 100644 index 0000000000000000000000000000000000000000..3873c95145933cde9ca1278f529025bf973aa59e --- /dev/null +++ b/lib/Drupal/views/Plugins/views/argument/Broken.php @@ -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; } +} diff --git a/lib/Drupal/views/Plugins/views/field/Broken.php b/lib/Drupal/views/Plugins/views/field/Broken.php new file mode 100644 index 0000000000000000000000000000000000000000..1ca24abebf134901030fa24ce9d5a2e0ac7983c7 --- /dev/null +++ b/lib/Drupal/views/Plugins/views/field/Broken.php @@ -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; } +} diff --git a/lib/Drupal/views/Plugins/views/field/FieldPluginBase.php b/lib/Drupal/views/Plugins/views/field/FieldPluginBase.php index 4dc3a5763c2f30c7ce0da22188ebac6a8747d2c0..dce63a3135c2ac80467c34bfb54bdb807890b421 100644 --- a/lib/Drupal/views/Plugins/views/field/FieldPluginBase.php +++ b/lib/Drupal/views/Plugins/views/field/FieldPluginBase.php @@ -1620,31 +1620,6 @@ function ui_name($short = FALSE) { } -/** - * 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; } -} - - /** * @} */ diff --git a/lib/Drupal/views/Plugins/views/filter/Broken.php b/lib/Drupal/views/Plugins/views/filter/Broken.php new file mode 100644 index 0000000000000000000000000000000000000000..113e5b6e8ae51a1c358d91ffc72d6a2808378cc2 --- /dev/null +++ b/lib/Drupal/views/Plugins/views/filter/Broken.php @@ -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; } +} diff --git a/lib/Drupal/views/Plugins/views/filter/FilterPluginBase.php b/lib/Drupal/views/Plugins/views/filter/FilterPluginBase.php index dddfb55d7b47d65d57df5477182c666bdfef142f..7311213c59f0a82a3383a5b3cf9e50554f5dcea9 100644 --- a/lib/Drupal/views/Plugins/views/filter/FilterPluginBase.php +++ b/lib/Drupal/views/Plugins/views/filter/FilterPluginBase.php @@ -718,32 +718,6 @@ function can_group() { } } - -/** - * 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; } -} - - /** * @} */ diff --git a/lib/Drupal/views/Plugins/views/sort/Broken.php b/lib/Drupal/views/Plugins/views/sort/Broken.php new file mode 100644 index 0000000000000000000000000000000000000000..0aa29ae8006c040c8f4f587e79ae7fd1c8623d01 --- /dev/null +++ b/lib/Drupal/views/Plugins/views/sort/Broken.php @@ -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; } +} diff --git a/lib/Drupal/views/Plugins/views/sort/SortPluginBase.php b/lib/Drupal/views/Plugins/views/sort/SortPluginBase.php index 347084da0b936192931bfea6b6fa5b097d2ec753..da5221e74b8b6382fcbaac9eaa78409eae471594 100644 --- a/lib/Drupal/views/Plugins/views/sort/SortPluginBase.php +++ b/lib/Drupal/views/Plugins/views/sort/SortPluginBase.php @@ -222,37 +222,6 @@ function expose_options() { } } -/** - * 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; } -} - - /** * @} */ diff --git a/views.module b/views.module index 247504cacad90b722ab3db2224a6c67f7e9f941c..19e54fd3a4b809bf3d56c53faa70f258531940da 100644 --- a/views.module +++ b/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; }