function iframe_debug in Iframe 8
Same name and namespace in other branches
- 8.2 iframe.module \iframe_debug()
- 7 iframe.module \iframe_debug()
Debug the iframe module.
Function "dpr" is from devel-module, we will use it if exists.
File
- ./
iframe.module, line 20 - Defines an iframe field with all attributes.
Code
function iframe_debug($level, $func = 'iframe', $debugvar = NULL) {
if ($level <= IFRAME_DEBUG_LEVEL) {
try {
$develdumper = \Drupal::service('devel.dumper', false);
} catch (Exception $exception) {
$develdumper = '';
}
if (isset($develdumper) && is_object($develdumper)) {
$develdumper
->dumpOrExport($debugvar, $func, NULL, 'drupal_variable');
}
else {
if (is_object($debugvar)) {
$debugvar = [
get_class($debugvar),
get_class_methods($debugvar),
];
}
error_log('ID: ' . $level . ' ' . $func);
\Drupal::messenger()
->addMessage('[iframe(' . $level . ')] ' . $func . ' ' . print_r($debugvar, TRUE), 'warning');
}
}
}