function AssetControllerBase::getGroup

Same name in other branches
  1. 10 core/modules/system/src/Controller/AssetControllerBase.php \Drupal\system\Controller\AssetControllerBase::getGroup()

Gets a group.

Parameters

array $groups: An array of asset groups.

int $group_delta: The group delta.

Return value

array The correct asset group matching $group_delta.

Throws

\Symfony\Component\HttpKernel\Exception\BadRequestHttpException Thrown when the filename is invalid.

1 call to AssetControllerBase::getGroup()
AssetControllerBase::deliver in core/modules/system/src/Controller/AssetControllerBase.php
Generates an aggregate, given a filename.

File

core/modules/system/src/Controller/AssetControllerBase.php, line 232

Class

AssetControllerBase
Defines a controller to serve asset aggregates.

Namespace

Drupal\system\Controller

Code

protected function getGroup(array $groups, int $group_delta) : array {
    if (isset($groups[$group_delta])) {
        return $groups[$group_delta];
    }
    throw new BadRequestHttpException('Invalid filename.');
}

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