1 dblog.test | protected DBLogTestCase::getSeverityConstant($class) |
Gets the watchdog severity constant corresponding to the CSS class.
Parameters
string $class: CSS class attribute.
Return value
int|null: The watchdog severity constant or NULL if not found.
File
- core/
modules/ dblog/ tests/ dblog.test, line 650 - Tests for dblog.module.
Class
- DBLogTestCase
- Tests logging messages to the database.
Code
protected function getSeverityConstant($class) {
// Reversed array from dblog_overview().
$levels = watchdog_severity_levels('name');
foreach (array_reverse($levels, TRUE) as $key => $value) {
$map['dblog-' . $value] = $key;
}
// Find the class that contains the severity.
$classes = explode(' ', $class);
foreach ($classes as $class) {
if (isset($map[$class])) {
return $map[$class];
}
}
return NULL;
}