开发者

Drupal views 2 API

开发者 https://www.devze.com 2023-04-11 09:59 出处:网络
I would like to create a custom views, because some database fields are not accessible by drupal views UI. I just exported an existing view into a file called my_module_views_default.inc that contains

I would like to create a custom views, because some database fields are not accessible by drupal views UI. I just exported an existing view into a file called my_module_views_default.inc that contains the hook_views_default_views() function. and by the drupal views2 document state that the hook gets called aut开发者_StackOverflow中文版omatically, but it doesn't. Also i want to know the path, we are giving the path in the code here

$handler->override_option('path', 'my_earnings');

That means we can see the views in the link http://localhost/drupal6/my_earnings ??

and in my .module file, i use the hook_views_api as follows

function mymodule_views_api() {

return array( 'api' => 2, 'path' => drupal_get_path('module', 'my_earnings'), ); }


I have found the document Using default views in your module and i created a new module, and i exporting a existing view. Then i placing my exported views into new module in file mymodule.views_default.inc. My views should now be listed as Overridden on the view list page and clear the Views cache. Revert these views, they will be removed from the database, but will remain in code.

Thanks alot to all..


I was caught with the same issue where i needed to join the two table in view. fortunately i found these links

http://drupalmodules.com/module/reverse-node-reference module enhances views with reverse relationships for node reference fields.

you may also need http://drupal.org/project/noderelationships

Using these module i don't think we need any custom module writing for view.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号