Skip to content

Commit 9311b40

Browse files
committed
Adding assets and scripts
1 parent bfda505 commit 9311b40

6 files changed

+257
-0
lines changed

assets/patches/.htaccess.patch

Whitespace-only changes.

assets/patches/features-wsod.patch

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Index: web/modules/contrib/features/src/FeaturesManager.php
2+
IDEA additional info:
3+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
4+
<+>UTF-8
5+
===================================================================
6+
diff --git a/codebase/web/modules/contrib/features/src/FeaturesManager.php b/codebase/web/modules/contrib/features/src/FeaturesManager.php
7+
--- a/web/modules/contrib/features/src/FeaturesManager.php (date 1613155743839)
8+
+++ b/web/modules/contrib/features/src/FeaturesManager.php (date 1613155743839)
9+
@@ -1224,20 +1224,19 @@
10+
foreach ($config as $item_name => $label) {
11+
$name = $this->getFullName($config_type, $item_name);
12+
$data = $this->configStorage->read($name);
13+
- if ($data) {
14+
- $config_collection[$name] = (new ConfigurationItem($name, $data, [
15+
- 'shortName' => $item_name,
16+
- 'label' => $label,
17+
- 'type' => $config_type,
18+
- 'dependents' => array_keys($dependency_manager->getDependentEntities('config', $name)),
19+
- // Default to the install directory.
20+
- 'subdirectory' => isset($existing_config_by_directory[$name]) ? $existing_config_by_directory[$name] : InstallStorage::CONFIG_INSTALL_DIRECTORY,
21+
- 'package' => '',
22+
- 'providerExcluded' => NULL,
23+
- 'provider' => isset($existing_config[$name]) ? $existing_config[$name] : NULL,
24+
- 'packageExcluded' => [],
25+
- ]));
26+
- }
27+
+
28+
+ $config_collection[$name] = (new ConfigurationItem($name, $data, [
29+
+ 'shortName' => $item_name,
30+
+ 'label' => $label,
31+
+ 'type' => $config_type,
32+
+ 'dependents' => array_keys($dependency_manager->getDependentEntities('config', $name)),
33+
+ // Default to the install directory.
34+
+ 'subdirectory' => isset($existing_config_by_directory[$name]) ? $existing_config_by_directory[$name] : InstallStorage::CONFIG_INSTALL_DIRECTORY,
35+
+ 'package' => '',
36+
+ 'providerExcluded' => NULL,
37+
+ 'provider' => isset($existing_config[$name]) ? $existing_config[$name] : NULL,
38+
+ 'packageExcluded' => [],
39+
+ ]));
40+
}
41+
}
42+
$this->setConfigCollection($config_collection);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Index: web/modules/contrib/quicktabs/src/Plugin/TabType/BlockContent.php
2+
IDEA additional info:
3+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
4+
<+>UTF-8
5+
===================================================================
6+
--- web/modules/contrib/quicktabs/src/Plugin/TabType/BlockContent.php (date 1605218182192)
7+
+++ web/modules/contrib/quicktabs/src/Plugin/TabType/BlockContent.php (date 1605218182192)
8+
@@ -85,6 +85,11 @@
9+
$render = $plugin_block->build();
10+
}
11+
12+
+ // If this is a view's block and is empty do not render the tab
13+
+ if ($render['#type'] === 'view' && !count($render['#view']->result)) {
14+
+ return [];
15+
+ }
16+
+
17+
return $render;
18+
}
19+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Index: web/modules/contrib/islandora_defaults/modules/islandora_mirador/src/Plugin/Block/MiradorBlock.php
2+
IDEA additional info:
3+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
4+
<+>UTF-8
5+
===================================================================
6+
--- web/modules/contrib/islandora_defaults/modules/islandora_mirador/src/Plugin/Block/MiradorBlock.php (date 1606509418942)
7+
+++ web/modules/contrib/islandora_defaults/modules/islandora_mirador/src/Plugin/Block/MiradorBlock.php (date 1606509418942)
8+
@@ -4,6 +4,7 @@
9+
10+
use Drupal\Core\Block\BlockBase;
11+
use Drupal\Core\Cache\Cache;
12+
+use Drupal\Core\Entity\EntityBase;
13+
use Drupal\Core\Form\FormStateInterface;
14+
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
15+
use Drupal\Core\Routing\RouteMatchInterface;
16+
@@ -107,21 +108,23 @@
17+
*/
18+
public function build() {
19+
$node = $this->routeMatch->getParameter('node');
20+
- $manifest_url = $this->token->replace($this->configuration['iiif_manifest_url'], ['node' => $node]);
21+
- $id = 'mirador_' . $node->id();
22+
- $build = [
23+
- "#title" => $this->t('Mirador Viewer'),
24+
- "#description" => $this->t("A div for mirador viewer"),
25+
- "#theme" => "mirador",
26+
- '#mirador_view_id' => $id,
27+
- '#iiif_manifest_url' => $manifest_url,
28+
- "#attached" => [
29+
- 'drupalSettings' => [
30+
- 'iiif_manifest_url' => $manifest_url,
31+
- 'mirador_view_id' => $id,
32+
- ],
33+
- ],
34+
- ];
35+
+ if ($node instanceof EntityBase) {
36+
+ $manifest_url = $this->token->replace($this->configuration['iiif_manifest_url'], ['node' => $node]);
37+
+ $id = 'mirador_' . $node->id();
38+
+ $build = [
39+
+ "#title" => $this->t('Mirador Viewer'),
40+
+ "#description" => $this->t("A div for mirador viewer"),
41+
+ "#theme" => "mirador",
42+
+ '#mirador_view_id' => $id,
43+
+ '#iiif_manifest_url' => $manifest_url,
44+
+ "#attached" => [
45+
+ 'drupalSettings' => [
46+
+ 'iiif_manifest_url' => $manifest_url,
47+
+ 'mirador_view_id' => $id,
48+
+ ]
49+
+ ]
50+
+ ];
51+
+ }
52+
53+
return $build;
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Index: src/FeaturesManager.php
2+
IDEA additional info:
3+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
4+
<+>UTF-8
5+
===================================================================
6+
diff --git a/src/FeaturesManager.php b/src/FeaturesManager.php
7+
--- a/src/FeaturesManager.php (revision 6a60f892626b22b7170f8838f0ef82b44a318a68)
8+
+++ b/src/FeaturesManager.php (date 1613158410066)
9+
@@ -1224,19 +1224,20 @@
10+
foreach ($config as $item_name => $label) {
11+
$name = $this->getFullName($config_type, $item_name);
12+
$data = $this->configStorage->read($name);
13+
-
14+
- $config_collection[$name] = (new ConfigurationItem($name, $data, [
15+
- 'shortName' => $item_name,
16+
- 'label' => $label,
17+
- 'type' => $config_type,
18+
- 'dependents' => array_keys($dependency_manager->getDependentEntities('config', $name)),
19+
- // Default to the install directory.
20+
- 'subdirectory' => isset($existing_config_by_directory[$name]) ? $existing_config_by_directory[$name] : InstallStorage::CONFIG_INSTALL_DIRECTORY,
21+
- 'package' => '',
22+
- 'providerExcluded' => NULL,
23+
- 'provider' => isset($existing_config[$name]) ? $existing_config[$name] : NULL,
24+
- 'packageExcluded' => [],
25+
- ]));
26+
+ if ($data) {
27+
+ $config_collection[$name] = (new ConfigurationItem($name, $data, [
28+
+ 'shortName' => $item_name,
29+
+ 'label' => $label,
30+
+ 'type' => $config_type,
31+
+ 'dependents' => array_keys($dependency_manager->getDependentEntities('config', $name)),
32+
+ // Default to the install directory.
33+
+ 'subdirectory' => isset($existing_config_by_directory[$name]) ? $existing_config_by_directory[$name] : InstallStorage::CONFIG_INSTALL_DIRECTORY,
34+
+ 'package' => '',
35+
+ 'providerExcluded' => NULL,
36+
+ 'provider' => isset($existing_config[$name]) ? $existing_config[$name] : NULL,
37+
+ 'packageExcluded' => [],
38+
+ ]));
39+
+ }
40+
}
41+
}
42+
$this->setConfigCollection($config_collection);

scripts/composer/ScriptHandler.php

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Contains \DrupalProject\composer\ScriptHandler.
6+
*/
7+
8+
namespace DrupalProject\composer;
9+
10+
use Composer\Script\Event;
11+
use Composer\Semver\Comparator;
12+
use Drupal\Core\Site\Settings;
13+
use DrupalFinder\DrupalFinder;
14+
use Symfony\Component\Filesystem\Filesystem;
15+
use Webmozart\PathUtil\Path;
16+
17+
class ScriptHandler {
18+
19+
public static function createRequiredFiles(Event $event) {
20+
$fs = new Filesystem();
21+
$drupalFinder = new DrupalFinder();
22+
$drupalFinder->locateRoot(getcwd());
23+
$drupalRoot = $drupalFinder->getDrupalRoot();
24+
25+
$dirs = [
26+
'modules',
27+
'profiles',
28+
'themes',
29+
];
30+
31+
// Required for unit testing
32+
foreach ($dirs as $dir) {
33+
if (!$fs->exists($drupalRoot . '/'. $dir)) {
34+
$fs->mkdir($drupalRoot . '/'. $dir);
35+
$fs->touch($drupalRoot . '/'. $dir . '/.gitkeep');
36+
}
37+
}
38+
39+
// Prepare the settings file for installation
40+
if (!$fs->exists($drupalRoot . '/sites/default/settings.php') && $fs->exists($drupalRoot . '/sites/default/default.settings.php')) {
41+
$fs->copy($drupalRoot . '/sites/default/default.settings.php', $drupalRoot . '/sites/default/settings.php');
42+
require_once $drupalRoot . '/core/includes/bootstrap.inc';
43+
require_once $drupalRoot . '/core/includes/install.inc';
44+
new Settings([]);
45+
$settings['settings']['config_sync_directory'] = (object) [
46+
'value' => Path::makeRelative($drupalFinder->getComposerRoot() . '/config/sync', $drupalRoot),
47+
'required' => TRUE,
48+
];
49+
drupal_rewrite_settings($settings, $drupalRoot . '/sites/default/settings.php');
50+
$fs->chmod($drupalRoot . '/sites/default/settings.php', 0666);
51+
$event->getIO()->write("Created a sites/default/settings.php file with chmod 0666");
52+
}
53+
54+
// Create the files directory with chmod 0777
55+
if (!$fs->exists($drupalRoot . '/sites/default/files')) {
56+
$oldmask = umask(0);
57+
$fs->mkdir($drupalRoot . '/sites/default/files', 0777);
58+
umask($oldmask);
59+
$event->getIO()->write("Created a sites/default/files directory with chmod 0777");
60+
}
61+
}
62+
63+
/**
64+
* Checks if the installed version of Composer is compatible.
65+
*
66+
* Composer 1.0.0 and higher consider a `composer install` without having a
67+
* lock file present as equal to `composer update`. We do not ship with a lock
68+
* file to avoid merge conflicts downstream, meaning that if a project is
69+
* installed with an older version of Composer the scaffolding of Drupal will
70+
* not be triggered. We check this here instead of in drupal-scaffold to be
71+
* able to give immediate feedback to the end user, rather than failing the
72+
* installation after going through the lengthy process of compiling and
73+
* downloading the Composer dependencies.
74+
*
75+
* @see https://github.com/composer/composer/pull/5035
76+
*/
77+
public static function checkComposerVersion(Event $event) {
78+
$composer = $event->getComposer();
79+
$io = $event->getIO();
80+
81+
$version = $composer::VERSION;
82+
83+
// The dev-channel of composer uses the git revision as version number,
84+
// try to the branch alias instead.
85+
if (preg_match('/^[0-9a-f]{40}$/i', $version)) {
86+
$version = $composer::BRANCH_ALIAS_VERSION;
87+
}
88+
89+
// If Composer is installed through git we have no easy way to determine if
90+
// it is new enough, just display a warning.
91+
if ($version === '@package_version@' || $version === '@package_branch_alias_version@') {
92+
$io->writeError('<warning>You are running a development version of Composer. If you experience problems, please update Composer to the latest stable version.</warning>');
93+
}
94+
elseif (Comparator::lessThan($version, '1.0.0')) {
95+
$io->writeError('<error>Drupal-project requires Composer version 1.0.0 or higher. Please update your Composer before continuing</error>.');
96+
exit(1);
97+
}
98+
}
99+
100+
}

0 commit comments

Comments
 (0)