Hello
The root of my question is that I am wondering what is the correct unique plugin identifier for extending the 'views_plugin_query_default class in a custom plugin?
Details
I am writing a module that extends the views_plugin_query_default class by implementing a plugin class handler. I have the module to the point where it registers the plugin class fine but it is not finding the include file to the implementation of the views_plugin_query_default class to allow me to override the appropriate methods.
The error I am receiving is as follows:
( ! ) Fatal error: Class 'views_plugin_query_default' not found in /path/modules/reach_matching_engine/plugins/ReachMatchingEngine_query.inc on line 4
Call Stack
# Time Memory Function Location
1 0.0002 60784 {main}( ) ../index.php:0
2 0.9766 45834856 theme( ) ../index.php:41
3 0.9768 45835536 call_user_func_array ( ) ../theme.inc:658
4 0.9768 45835536 template_preprocess_page( ) ../theme.inc:0
5 1.0295 46885536 theme( ) ../theme.inc:1774
6 1.0296 46885736 call_user_func_array ( ) ../theme.inc:617
7 1.0296 46885968 theme_blocks( ) ../theme.inc:0
8 1.0296 46886136 block_list( ) ../theme.inc:1580
9 1.0296 46887108 module_invoke( ) ../block.module:473
10 1.0296 46887888 call_user_func_array ( ) ../module.inc:450
11 1.0296 46888068 views_block( ) ../module.inc:0
12 1.1344 50156220 view->execute_display( ) ../views.module:385
13 1.1371 50170508 views_plugin_display_block->execute( ) ../view.inc:832
14 1.1371 50170508 view->render( ) ../views_plugin_display_block.inc:51
15 1.1371 50170508 view->execute( ) ../view.inc:716
16 1.1371 50170508 view->build( ) ../view.inc:673
17 1.1379 50172424 view->init_query( ) ../view.inc:566
18 1.1840 51287448 views_get_plugin( ) ../view.inc:530
19 1.1840 51287488 _views_create_handler( ) ../views.module:677
20 1.1840 51287488 views_include_handler( ) ../handlers.inc:17
21 1.1849 51337772 require_once( '/path/modules/reach_matching_engine/plugins/ReachMatchingEngine_query.inc' ) ../handlers.inc:77
I have read the views api documentation and I think I am not correctly specifying the parent value in the plugin registration. I noticed in the documetation the following statement indicates that I need to specific the correct unique plugin identified.
"handler registration, where parentage is referred to by object name, with plugins it is referred to by the unique plugin identifier"
I have included the views api hook in the module file and below is my plugin definition in the module.inc file
function ReachMatchingEngine_views_plugins() {
return array(
'module' => 'ReachMatchingEngine',
'query' => array(
'ReachMatchingEngine_query' => array(
'path' => drupal_get_path('module', 'ReachMatchingEngine') . '/plugins',
'title' => t('Reach Results'),
'help' => t('Query that allows you to match results.'),
'handler' => 'ReachMatchingEngine_query',
'parent' => 'views_query_default',
),
),
);
}
Thanks in advance..
G
Comments
Comment #1
dawehnerShould be 'default'
Comment #2
gsvitak commentedHello
Thank you for the quick response. I have replace the parent element with the suggestion and I am still getting the same error.. I clear the cache after the making the change as well as reinstalled the nodule via the devel module.
In order to provide more information, here is the class definition
and here is the declaration
function ReachMatchingEngine_views_plugins() {
return array(
'module' => 'ReachMatchingEngine',
'query' => array(
'ReachMatchingEngine_query' => array(
'path' => drupal_get_path('module', 'ReachMatchingEngine') . '/plugins',
'title' => t('Reach Results'),
'help' => t('Query that allows you to match results.'),
'handler' => 'ReachMatchingEngine_query',
'parent' => 'default',
),
),
);
}
Thanks for the help.
G
Comment #3
dawehnerAlso try out views_query
Comment #4
gsvitak commentedHello
That worked!!!
Thank you.. For my information, where would I look in the future to find the information on the base plugins to fill in this parameter (aka which source files would I look for)
thanks
G
Comment #5
merlinofchaos commentedincludes/plugins.inc
Comment #7
Equinger commentedI'm sorry to bother you guys, but I cannot activate a custom query plugin for the life of me. I've followed the advice above, but how do I activate it? Do I need to activate the plugin somewhere in the UI?
Comment #8
Equinger commentedI got it. I now understand that you need to use hook_views_data_alter(&$data)