All new views field plugin in Drupal 8
Views module is an integral part of the Drupal ecosystem. Almost every site built in Drupal uses Views. Views module was the first initiative to reach feature completion in Drupal 8. Like all other core systems the Views module has embraced PSR-4, the Plugins System, Annotations and ConfigEntities.
The display of the proper information in the proper format is an integral part of creating a view. Views module uses views field plugins for this. These views fields can be added using ViewsUI. In Drupal 7, views fields come with their own set of configurable options to customize the output of a field. Being out of step with core formatter APIs lead to styling nightmares, performance issues and cache problems on sites of even modest complexity.
Issues with views in Drupal 7
Styling nightmares: Views uses it's own markup templates to display views field plugins for many fields. Field formatters only work for the field plugins provided by field api.
Performance issues: More field plugins mean more complex views queries.
Cache Problem: Views module comes with its own caching system. Query caching and output caching are built in, but there is no built in support to cache views field plugins. In addition Views module doesn't leverage entity or render caching.
The API changes under the hood in Drupal 8 for views field plugins fixes all of these pain points.
In this session we'll discuss:
- What are views field plugins?
- How views field plugins work?
- Which views field plugins come with core?
- When to create a new views field plugin?
- How to create a views field plugin?
- How to use field formatters for base fields(entity properties) and field properties?
- How to leverage entity caching in views field plugins?
- How to leverage views row caching?
- How to integrate render caching in views field plugins?
- How to make sure the new views field plugin is not introducing performance regressions?
- How to make sure the new views field plugin is not introducing caching problems?
We'll also take a look into some contrib views field plugins.
About the speaker @jibran
- Has been working with Drupal for more then 4 years.
- Has more then 200 commit mentions in Drupal 8.
- Has reviewed a lot Drupal 8 patches.
- Has worked on a lot Views patches in Drupal 8.
- Is the maintainer of Views field view, Views fieldset style plugin, Views details style plugin, Views vertical tabs style plugin and Views collapsible group.