Skip to content
Snippets Groups Projects
Commit 4498c1e4 authored by simon's avatar simon
Browse files

Merge branch 'imp-v1-d10' into '1.x'

Imp v1 d10

See merge request !18
parents 14c28302 2778d9bb
Branches
1 merge request!18Imp v1 d10
Pipeline #7143 passed with warnings with stages
in 18 minutes and 9 seconds
################################################################################
# Gitlab CI integration for Drupal 8/9 project or module: tests, code quality,
# linting, metrics and deploy samples.
#
# Project: https://gitlab.com/mog33/gitlab-ci-drupal
# Documentation: https://mog33.gitlab.io/gitlab-ci-drupal
# Issues: https://gitlab.com/mog33/gitlab-ci-drupal/-/issues
# Author: Jean Valverde contact@dev-drupal.com
# License: GPL-3
#
# If you want to support this project, you can
# - Buy me a coffee: https://bit.ly/34jPKcE
# - Hire me as a freelance for any Drupal related work
# - Promote me to any company looking for any Drupal related work
# - Help me with testing / documentation / grammar fixes / use cases
#
################################################################################
# The ref is relative to the version of the project to use, best to use a tag.
include:
# If hosted on gitlab.com.
# - project: 'mog33/gitlab-ci-drupal'
# ref: 3.x-dev
# file: '/.gitlab-ci/.gitlab-ci-template.yml'
# If hosted on an other Gitlab instance.
# - remote: 'https://gitlab.com/mog33/gitlab-ci-drupal/-/raw/3.x-dev/.gitlab-ci/.gitlab-ci-template.yml'
- remote: 'https://git.startx.be/forks/gitlab-ci-drupal/-/raw/startx/.gitlab-ci/.gitlab-ci-template.yml'
# If needed by your Gitlab-ci instance, you can set global tags for all jobs.
# default:
# tags:
# - docker
################################################################################
# Gitlab-CI variables documentation:
# https://docs.gitlab.com/ee/ci/variables/
#
# Variables, can be set here or on
# Gitlab CI UI > settings > CI/CD > variables
# UI take precedence on variables here.
# https://docs.gitlab.com/ee/ci/variables/README.html#priority-of-environment-variables
################################################################################
variables:
# This is mandatory to get default variables.
extends: .default_variables
# Global config remote files ref.
# MUST be the same as include: ref: from above.
CI_REF: 3.x-dev
# Set a version, default is Drupal 8.9, can be 9.0 or 9.1.
# CI_DRUPAL_VERSION: "8.9"
##############################################################################
# Tests disabled by default because need a specific setup / configuration.
#
# Only needed if you have Behat tests, comment or set to 0 to enable.
# https://mog33.gitlab.io/gitlab-ci-drupal/advanced-usage/#behat-tests
SKIP_TEST_BEHAT: 1
# Accessibility tests, need a profile and setup.
# https://mog33.gitlab.io/gitlab-ci-drupal/advanced-usage/#accessibility-with-pa11y
SKIP_TEST_PA11Y: 1
# Only if you have Nightwatch tests in your code.
# https://mog33.gitlab.io/gitlab-ci-drupal/advanced-usage/#nightwatchjs
SKIP_TEST_NIGHTWATCH: 1
# Default is '--skiptags core', add your tag.
# NIGHTWATCH_TESTS: --tag my_module
# Phpunit tests to run, default provide only custom code or if this variable
# is empty all tests (including Drupal core).
# https://mog33.gitlab.io/gitlab-ci-drupal/advanced-usage/#phpunit-tests
PHPUNIT_TESTS: "custom"
##############################################################################
# Override default variables for a module.
#
# Default CI setup is for a 'project' (full Drupal with a composer.json), next
# section contains common variables to change for a module (module, theme or
# profile). Simply uncomment and adapt dirs to set the CI for a module.
#
CI_TYPE: module
# Code quality dirs, must include your PHP code to check.
# Phpstan need autoloading, that's why we use web_root.
DIRS_QA: "${WEB_ROOT}/modules/custom"
# Eslint / Stylelint files to test.
DIRS_JS: "${CI_PROJECT_DIR}/js/*.js"
DIRS_CSS: "${CI_PROJECT_DIR}/css/*.css"
# Twig files to test.
DIRS_TWIG: "${CI_PROJECT_DIR}/templates"
# phpmetrics / phpstats dirs to include.
DIRS_PHP: "${CI_PROJECT_DIR}"
# Set SKIP_XXX variable to 1 to skip.
# Security is for a Drupal project with third party.
SKIP_TEST_SECURITY: 1
# If you don't have any css files, you can skip with
SKIP_LINT_CSS: 1
# If you don't have any javascript files, you can skip with
SKIP_LINT_JS: 1
# If you don't have any twig files, you can skip with
SKIP_LINT_TWIG: 1
#
##############################################################################
##############################################################################
# As a sample here is a list of some variables, see documentation for more
# variables.
#
# List of DIRS_* variables to define dirs to analyse for specific jobs.
# Code quality dirs, must include your PHP code to check.
#
# DIRS_QA: "${WEB_ROOT}/modules/custom,${WEB_ROOT}/themes/custom"
#
# Eslint / Stylelint files to test.
# Space separated for multiple folders.
# Default is to check files under all custom folders.
#
# DIRS_JS: "${WEB_ROOT}/**/custom/**/*.js"
# DIRS_CSS: "${WEB_ROOT}/**/custom/**/css/*.css"
#
# Twig files to test, recursive.
#
# DIRS_TWIG: "${WEB_ROOT}/themes/custom"
#
# Phpmetrics / Phpstats dirs to include.
# Default is to check all dirs.
#
# DIRS_PHP: "${WEB_ROOT}/modules/custom,${WEB_ROOT}/themes/custom"
#
# # ALL SKIP variables, uncomment and set to 1 to skip a job.
# SKIP_BUILD: 1 # if not running any tests or deploy.
#
# SKIP_TESTS: 1 # Skip all tests, ignore SKIP_TEST_*.
# SKIP_TEST_UNITKERNEL: 1
# SKIP_TEST_FUNCTIONAL: 1
# SKIP_TEST_FUNCTIONALJS: 1
# SKIP_TEST_SECURITY: 1
#
# SKIP_QA: 1
#
# SKIP_LINT: 1 # Skip all lint, ignore SKIP_LINT_*.
# SKIP_LINT_CSS: 1
# SKIP_LINT_JS: 1
# SKIP_LINT_TWIG: 1
#
# SKIP_METRICS: 1
# QA and Metrics tools.
# See Phpqa available tools: https://github.com/EdgedesignCZ/phpqa#available-tools
# ':0' is the number of errors allowed, default here is very strict.
#
# TOOLS_QA: "phpcs:0,phpmd:0,parallel-lint:0,phpstan:0,phpcpd:0"
# TOOLS_METRICS: "phpmetrics,phploc,pdepend"
- remote: 'https://git.drupalcode.org/project/gitlab_templates/-/raw/1.0.x/includes/include.drupalci.main.yml'
- remote: 'https://git.drupalcode.org/project/gitlab_templates/-/raw/1.0.x/includes/include.drupalci.variables.yml'
# - remote: 'https://git.drupalcode.org/project/gitlab_templates/-/raw/1.0.x/includes/include.drupalci.workflows.yml'
- remote: 'https://git.startx.be/infra/gitlabci-drupal/-/raw/main/includes/include.drupalci.workflows.yml'
################################################################################
# Advanced usage with this file, see doc.
# https://mog33.gitlab.io/gitlab-ci-drupal/advanced-usage
################################################################################
<?php
/**
* @file
* You can use this file to run extra Robo build tasks.
*
* See RoboFile.php and https://robo.li/ documentation to run a task.
*
* For CI_TYPE='project', this file is executed directly during the Build job
* script after the regular composer install.
*
* For CI_TYPE='module', this file is executed on each 'before_script' part of
* jobs.
*
* It's important to have any action relative to the docRoot or webRoot
* as we are not working from the CI_PROJECT_DIR.
*
* Examples:
*
* $this->say("This will be run in Build script!");
*
* $this->taskGulpRun()
* ->dir($this->webRoot . 'themes/my_theme_with_gulp_task')
* ->run();
*
* $this->taskComposerRequire()
* ->noInteraction()
* ->noAnsi()
* ->workingDir($this->docRoot);
* ->dependency('drupal/webform', '^5.13')
* ->run();
*
* Or shortcut method in the RoboFile.php with this project:
* $this->composerRequire()
* ->dependency('drupal/webform', '^5.13')
* ->run();
*/
$this->taskComposerConfig()
->noInteraction()
->noAnsi()
->workingDir($this->docRoot)
->repository("0", "https://packages.startx.be", "composer")
->run();
$this->taskComposerConfig()
->noInteraction()
->noAnsi()
->workingDir($this->docRoot)
->repository("1", "https://packages.drupal.org/8", "composer")
->run();
$this->composerRequire()
->dependency('drupal/views_bulk_operations', '^4.0')
->run();
......@@ -13,6 +13,9 @@
"require": {
"mikehaertl/phpwkhtmltopdf": "^2.3"
},
"require-dev": {
"drupal/views_bulk_operations": "^4.0"
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
......
name: 'Mail Template'
type: module
description: 'Mail Template'
core_version_requirement: ^8.8 || ^9
core_version_requirement: ^8.8 || ^9 || ^10
package: 'startx'
dependencies:
- views
......
......@@ -69,7 +69,7 @@ class DownloadDocumentAction extends ViewsBulkOperationsActionBase {
if (count($this->context['sandbox']['results']) > 1) {
$destination = $wrapper . '://documents.zip';
$archive_file = file_save_data(hex2bin('504b0506000000000000000000000000000000000000'), $destination);
$archive_file = \Drupal::service('file.repository')->writeData(hex2bin('504b0506000000000000000000000000000000000000'), $destination);
$archive_file->setTemporary();
$archive_file->save();
......@@ -84,7 +84,7 @@ class DownloadDocumentAction extends ViewsBulkOperationsActionBase {
$file_number++;
}
$file_url = Url::fromUri(file_create_url($archive_file->getFileUri()));
$file_url = \Drupal::service('file_url_generator')->generate($archive_file->getFileUri());
$link = Link::fromTextAndUrl($this->t('Click here'), $file_url);
$this->messenger()->addMessage($this->t('Document archive created. @link to download.', ['@link' => $link->toString()]));
}
......@@ -94,11 +94,11 @@ class DownloadDocumentAction extends ViewsBulkOperationsActionBase {
// FIXME: filename.
$destination = $wrapper . '://document.pdf';
$fileobj = file_save_data(file_get_contents($fileUri), $destination);
$fileobj = \Drupal::service('file.repository')->writeData(file_get_contents($fileUri), $destination);
$fileobj->setTemporary();
$fileobj->save();
$file_url = Url::fromUri(file_create_url($fileobj->getFileUri()));
$file_url = \Drupal::service('file_url_generator')->generate($fileobj->getFileUri());
$link = Link::fromTextAndUrl($this->t('Click here'), $file_url);
$this->messenger()->addMessage($this->t('Document created. @link to download.', ['@link' => $link->toString()]));
}
......
......@@ -94,7 +94,7 @@ class DownloadSingleDocumentAction extends ViewsBulkOperationsActionBase {
if (count($this->context['sandbox']['results']) > 1) {
$destination = $wrapper . '://documents.zip';
$archive_file = file_save_data('', $destination);
$archive_file = \Drupal::service('file.repository')->writeData('', $destination);
$archive_file->setTemporary();
$archive_file->save();
......@@ -109,7 +109,7 @@ class DownloadSingleDocumentAction extends ViewsBulkOperationsActionBase {
$file_number++;
}
$file_url = Url::fromUri(file_create_url($archive_file->getFileUri()));
$file_url = \Drupal::service('file_url_generator')->generate($archive_file->getFileUri());
$link = Link::fromTextAndUrl($this->t('Click here'), $file_url);
$this->messenger()->addMessage($this->t('Document archive created. @link to download.', ['@link' => $link->toString()]));
}
......@@ -119,11 +119,11 @@ class DownloadSingleDocumentAction extends ViewsBulkOperationsActionBase {
// FIXME: filename.
$destination = $wrapper . '://document.pdf';
$fileobj = file_save_data(file_get_contents($fileUri), $destination);
$fileobj = \Drupal::service('file.repository')->writeData(file_get_contents($fileUri), $destination);
$fileobj->setTemporary();
$fileobj->save();
$file_url = Url::fromUri(file_create_url($fileobj->getFileUri()));
$file_url = \Drupal::service('file_url_generator')->generate($fileobj->getFileUri());
$link = Link::fromTextAndUrl($this->t('Click here'), $file_url);
$this->messenger()->addMessage($this->t('Document created. @link to download.', ['@link' => $link->toString()]));
}
......
......@@ -2,10 +2,12 @@
namespace Drupal\mail_template\TwigExtension;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
/**
* Provides TwigExtension for the MailTemplate module.
*/
class MailTemplateTwigExtension extends \Twig_Extension {
class MailTemplateTwigExtension extends AbstractExtension {
/**
* {@inheritdoc}
......@@ -40,7 +42,7 @@ class MailTemplateTwigExtension extends \Twig_Extension {
*/
public function getFunctions() {
return [
new \Twig_SimpleFunction('getPasswordReset', [$this, 'getPasswordReset'], []),
new TwigFunction('getPasswordReset', [$this, 'getPasswordReset'], []),
];
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment