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