getVar(...)), new TwigFunction('entityId', $this->getEntityId(...)), ]; } public function getVar(string $name): string { return $_ENV[$name]; } public function getEntityId(FieldDto $field): string { $url = $field->getCustomOption('toggleUrl'); preg_match('/entityId=(\d+)/', $url, $matches); return $matches[1]; } }