function Group::__construct

Same name and namespace in other branches
  1. main core/lib/Drupal/Core/Theme/DesignToken/Group.php \Drupal\Core\Theme\DesignToken\Group::__construct()

Construct a DTCG group.

Parameters

string $provider: The Drupal extension providing the group.

string $name: The group's machine name.

\Drupal\Core\Theme\DesignToken\DtcgInterface[] $children: The children (groups or tokens).

?\Drupal\Core\Theme\DesignToken\Group $parent: The parent group. Groups can be nested.

?\Drupal\Core\StringTranslation\TranslatableMarkup $description: A plain text description explaining the group's purpose.

?string $type: The group type if present.

File

core/lib/Drupal/Core/Theme/DesignToken/Group.php, line 39

Class

Group
A group: distinguishable by not having a $value property.

Namespace

Drupal\Core\Theme\DesignToken

Code

public function __construct(public readonly string $provider, public readonly string $name, protected array $children = [], public readonly ?Group $parent = NULL, public readonly ?TranslatableMarkup $description = NULL, ?string $type = NULL) {
  $this->type = $type ?? $parent->type ?? NULL;
  assert(Inspector::assertAllObjects($children, DtcgInterface::class));
}

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