Currently the functions provided by devel not allow to fully use the dumper system in procedural code; for example is not possible to select a specific plugin when you dump a variable. The idea is create some (prefixed) functions that allow to fully use the dumper system:
- devel_dump()
- devel_export()
- devel_message()
- devel_debug()

Note: the not replace the devel's existing functions

Once these functions are in we should make use of they in all the procedural code. The advantages of doing that are:
- fully use the dumper system from procedural code
- more intuitive names and better documentation
- prefixed functions == no more conflict with other modules or libraries
- the calls to devel.dumper are not more scattered in all devel functions. If we want to make a change, we could touch only these functions
- we can remove ::dumpOrExport from DevelDumperManager/Interface

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

willzyx created an issue. See original summary.

willzyx’s picture

Status: Active » Needs review
FileSize
2.74 KB
moshe weitzman’s picture

When would we use these in our own code? These wrappers seem useful to devs doing debugging.

willzyx’s picture

we can use it in all the devel debug functions (dpm() , kpr() etc)

for example this

function dpm($input, $name = NULL, $type = 'status') {
  \Drupal::service('devel.dumper')->message($input, $name, $type);
  return $input;
}

can be converted to use the new function

function dpm($input, $name = NULL, $type = 'status') {
  return devel_message($input, $name, $type);
}

the advantages of doing that are described in the IS :)

moshe weitzman’s picture

Still needed? LGTM

  • willzyx committed 20f559e on 8.x-2.x
    Issue #2840373 by willzyx: Add functions that allow to fully use the...
willzyx’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.