You are here

protected function HelperTrait::composeStyles in Style Switcher 3.0.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/HelperTrait.php \Drupal\Tests\styleswitcher\Functional\HelperTrait::composeStyles()

Helps compose the Styles array.

Parameters

array $label_paths: Array with "label => path" associations.

string $type: (optional) Style type: "custom" or "theme".

Return value

array[] Styles list as in the config.

File

tests/src/Functional/HelperTrait.php, line 60

Class

HelperTrait
Provides helper methods for the Style Switcher testing.

Namespace

Drupal\Tests\styleswitcher\Functional

Code

protected function composeStyles(array $label_paths, string $type = 'custom') : array {
  $styles = [];
  foreach ($label_paths as $label => $path) {
    $name = $type . '/' . strtolower($label);
    $styles[$name] = [
      'name' => $name,
      'label' => $label,
      'path' => $path,
    ];
  }
  return $styles;
}