function IconFinder::determineGroupPosition

Determines the group position based on the URI.

The group position is needed to use it as a mask to find the folder name matching this position.

Parameters

string $source: The source with optional group pattern.

Return value

int|null The determined group position.

1 call to IconFinder::determineGroupPosition()
IconFinder::getFilesFromPath in core/lib/Drupal/Core/Theme/Icon/IconFinder.php
Get files from a local path.

File

core/lib/Drupal/Core/Theme/Icon/IconFinder.php, line 368

Class

IconFinder
Icon finder to discover files under specific paths or URLs.

Namespace

Drupal\Core\Theme\Icon

Code

private static function determineGroupPosition(string $source) : ?int {
    $parts = explode('/', trim($source, '/'));
    if ($result = array_search(self::GROUP_PATTERN, $parts, TRUE)) {
        return (int) $result;
    }
    return NULL;
}

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