backdrop-contrib / ds

Display Suite gives you full control over the way content is displayed without having to maintain dozens of PHP template files.
GNU General Public License v2.0
0 stars 2 forks source link

Error: Call to undefined function dpm() #4

Closed philsward closed 3 years ago

philsward commented 3 years ago

When navigating to the DS Extras page, the following error is presented and nothing can be done on the page except navigate elsewhere.

Error: Call to undefined function dpm() in ds_extras_settings() (line 162 of /home/user/public_html/t/sandbox/backdrop1.sandbox/modules/ds/modules/ds_extras/includes/ds_extras.admin.inc).DismissCall to undefined function dpm()

/admin/structure/ds/list/extras

philsward commented 3 years ago

Research tells me dpm() is for devel, and if devel isn't installed it will throw this error.

There are three solutions: 1) Remove dpm($form); altogether 2) Comment out dpm($form); if it is only being used for testing while coding and isn't necessary for general use 3) Add a check to see if devel is installed and if not, ignore dpm($form);.

I did what I thought would be the correct thing to do and added a check if (function_exists('dpm')) { } to wrap dpm($form); starting at line 162 in /ds/modules/ds_extras/includes/ds_extras.admin.inc

  $form = system_settings_form($form);
  $form['#submit'][] = 'ds_extras_settings_submit';
  if (function_exists('dpm')) {
  dpm($form);
  }
  return $form;
}
philsward commented 3 years ago

Thinking about this, I'm guessing dpm(); is used elsewhere throughout ds and needs to be dealt with. I have not tried to search for it to know, but seeing how there is a Display Suite Devel module, I can only assume this will crop up in other places.

philsward commented 3 years ago

Other places this needs addressed:

./modules/ds/modules/ds_ui/includes/ds.fields.inc: dpm($form); ./modules/ds/modules/ds_ui/includes/ds.fields.inc: dpm($name); ./modules/ds/modules/ds_ui/includes/ds.fields.inc: dpm($config->isNew()); ./modules/ds/modules/ds_extras/includes/ds_extras.admin.inc: dpm($form); ./modules/ds/modules/ds_extras/ds_extras.module: dpm(FUNCTION); ./modules/ds/modules/ds_extras/ds_extras.module: dpm($options);

hosef commented 3 years ago

Thanks for reporting this. I forgot to remove these when I was first porting the module, so I have removed them.