Views hooks

Views also comes with a lot of hooks. We've already seen an important one that allowed us to expose our own data to Views. But there are many more, and you should check out the views.api.php file for more information.

Quite a few exist for altering plugin information for all sorts of plugin types. But there are also some important ones that deal with Views execution at runtime. The most notable of these is hook_views_query_alter() which allows us to make alterations to the final query that is going to be run. There is also hook_views_post_render() and hook_views_pre_render(), which allow us to make alterations to the View results. For example, to change the order of the items or something like that.

I recommend you check out their respective documentation and make yourself aware of what you can do with these hooks. At times they can be helpful, even if, with Drupal 8, most of the action happens in plugins and you can easily now write your own to handle your specific requirements. This is why we won't be going into great detail about these.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset