Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitlab_api
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
gitlab_api
Commits
4f16c8af
Commit
4f16c8af
authored
5 years ago
by
Jürgen Haas
Browse files
Options
Downloads
Patches
Plain Diff
Store project and URL of git repo
parent
0cd9c24e
Branches
Branches containing commit
Tags
2.0.0-beta2
2.0.0-rc1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Plugin/WebformHandler/CreateProject.php
+10
-1
10 additions, 1 deletion
src/Plugin/WebformHandler/CreateProject.php
with
10 additions
and
1 deletion
src/Plugin/WebformHandler/CreateProject.php
+
10
−
1
View file @
4f16c8af
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment