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

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
{
"name": "drupal/gitlab_api",
"type": "drupal-module",
"description": "Integrates your Drupal site into GitLab using the GitLab API.",
"keywords": [
"Drupal",
"GitLab",
"API"
],
"license": "GPL-2.0+",
"homepage": "https://www.drupal.org/project/gitlab_api",
"authors": [
{
"name": "Jürgen Haas",
"homepage": "https://www.drupal.org/u/jurgenhaas"
}
],
"minimum-stability": "dev",
"support": {
"issues": "https://www.drupal.org/project/issues/gitlab_api",
"source": "https://git.drupal.org/project/gitlab_api"
},
"require": {
"m4tthumphrey/php-gitlab-api": "^9.13",
"php-http/guzzle6-adapter": "^1.0"
}
}
name: GitLab API
type: module
description: Integrates your Drupal site into GitLab using the GitLab API.
package: Web services
core: 8.x
project: gitlab_api
<?php
namespace Drupal\gitlab_api\Plugin\WebformHandler;
use Drupal\webform\Plugin\WebformHandlerBase;
use Drupal\webform\WebformSubmissionInterface;
/**
* Webform submission handler to create a new GitLab project.
*
* @WebformHandler(
* id = "gitlab_api_create_project",
* label = @Translation("Create Project"),
* category = @Translation("GitLab"),
* description = @Translation("Create a new GitLab project."),
* cardinality = \Drupal\webform\Plugin\WebformHandlerInterface::CARDINALITY_UNLIMITED,
* results = \Drupal\webform\Plugin\WebformHandlerInterface::RESULTS_PROCESSED,
* submission = \Drupal\webform\Plugin\WebformHandlerInterface::SUBMISSION_REQUIRED,
* tokens = TRUE,
* )
*/
class CreateProject extends WebformHandlerBase {
public function postSave(WebformSubmissionInterface $webform_submission, $update = TRUE) {
$state = $webform_submission->getWebform()->getSetting('results_disabled') ?
WebformSubmissionInterface::STATE_COMPLETED :
$webform_submission->getState();
if ($this->configuration['states'] && in_array($state, $this->configuration['states'], TRUE)) {
$data = $webform_submission->getData();
$data['gitlab_project'] = '';
$webform_submission->setData($data);
$webform_submission->save();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment