Skip to content
Snippets Groups Projects
Commit 4f16c8af authored by Jürgen Haas's avatar Jürgen Haas
Browse files

Store project and URL of git repo

parent 0cd9c24e
Branches
Tags
No related merge requests found
......@@ -86,6 +86,7 @@ class CreateProject extends WebformHandlerBase {
'namespace' => '',
'path_pattern' => '',
'name_pattern' => '',
'field_gitlab_project' => '',
'field_gitlab_url' => '',
];
}
......@@ -118,6 +119,13 @@ class CreateProject extends WebformHandlerBase {
'#required' => TRUE,
'#default_value' => $this->configuration['name_pattern'],
];
$form['field_gitlab_project'] = [
'#type' => 'select',
'#title' => $this->t('Field to store GitLab project'),
'#options' => $fields,
'#required' => TRUE,
'#default_value' => $this->configuration['field_gitlab_project'],
];
$form['field_gitlab_url'] = [
'#type' => 'select',
'#title' => $this->t('Field to store GitLab URL'),
......@@ -150,7 +158,8 @@ class CreateProject extends WebformHandlerBase {
$path = $this->replaceTokens($this->configuration['path_pattern'], $webform_submission);
$name = $this->replaceTokens($this->configuration['name_pattern'], $webform_submission);
$project = $this->api->createProject($this->configuration['namespace'], $path, $name);
$data[$this->configuration['field_gitlab_url']] = json_encode($project);
$data[$this->configuration['field_gitlab_project']] = json_encode($project);
$data[$this->configuration['field_gitlab_url']] = $project['ssh_url_to_repo'];
$webform_submission->setData($data);
try {
$webform_submission->save();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment