function DbLogTest::getSeverityConstant

Same name in other branches
  1. 9 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::getSeverityConstant()
  2. 8.9.x core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::getSeverityConstant()
  3. 10 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::getSeverityConstant()

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.

1 call to DbLogTest::getSeverityConstant()
DbLogTest::getLogEntries in core/modules/dblog/tests/src/Functional/DbLogTest.php
Gets the database log event information from the browser page.

File

core/modules/dblog/tests/src/Functional/DbLogTest.php, line 801

Class

DbLogTest
Verifies log entries and user access based on permissions.

Namespace

Drupal\Tests\dblog\Functional

Code

protected function getSeverityConstant($class) {
    $map = array_flip(DbLogController::getLogLevelClassMap());
    // Find the class that contains the severity.
    $classes = explode(' ', $class);
    foreach ($classes as $class) {
        if (isset($map[$class])) {
            return $map[$class];
        }
    }
    return NULL;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.