Replacement for clone_view() in Drupal 8

In Drupal 8, view::clone_view() (Drupal 7) and its inital replacement ViewExecutable::cloneView() was removed in #1858054: Remove ViewExecutable::cloneView(). Occasionally, a module may have the need to copy a view to perform additional query modifications without affecting the original view (think attachments and aggregation).

Luckily, there are a couple of ways to perform a similar cloning.

[read more]

Quick tips on using Devel and Kint for Drupal 8 debugging

In the Drupal 8 Devel module, a wrapper for the Kint debugging tool is included. This needs to be enabled in addition to Devel, and provides a stylish replacement for the Krumo output found in the Drupal 7 version.

To debug variables and objects withDevel and Kint, use one of various print methods: dpm(), dsm(), kpr(), kprint_r() in core or contrib (php) code:

[read more]