public function GuardFactory::get in State Machine 8
Gets the instantiated guards for the given group ID.
Parameters
string $group_id: The group ID.
Return value
\Drupal\state_machine\Guard\GuardInterface[] The instantiated guards.
Overrides GuardFactoryInterface::get
File
- src/
Guard/ GuardFactory.php, line 42
Class
- GuardFactory
- Default implementation of the guard factory.
Namespace
Drupal\state_machine\GuardCode
public function get($group_id) {
$service_ids = [];
if (isset($this->guardServiceIds[$group_id])) {
$service_ids = array_merge($service_ids, $this->guardServiceIds[$group_id]);
}
if (isset($this->guardServiceIds['_generic'])) {
$service_ids = array_merge($service_ids, $this->guardServiceIds['_generic']);
}
$guards = [];
foreach ($service_ids as $service_id) {
$guards[] = $this->container
->get($service_id);
}
return $guards;
}