Skip to content

Instantly share code, notes, and snippets.

View junaidpv's full-sized avatar

Junaid P V junaidpv

View GitHub Profile
diff --git a/core/modules/datetime/src/Plugin/views/filter/Date.php b/core/modules/datetime/src/Plugin/views/filter/Date.php
index 3ea593c1f8..0962de179b 100644
--- a/core/modules/datetime/src/Plugin/views/filter/Date.php
+++ b/core/modules/datetime/src/Plugin/views/filter/Date.php
@@ -109,6 +109,11 @@ protected function opBetween($field) {
// value as UNIX timestamp 0.
$min = (!empty($this->value['min'])) ? $this->value['min'] : '@0';
+ if (!empty($this->value['max']) && !strpos($this->value['max'], ':')) {
+ // No time was specified, so make the date range inclusive.
diff --git a/config/install/wysiwyg_template.settings.yml b/config/install/wysiwyg_template.settings.yml
index 8b3a650..b2380fd 100644
--- a/config/install/wysiwyg_template.settings.yml
+++ b/config/install/wysiwyg_template.settings.yml
@@ -1 +1,3 @@
library_path: 'libraries/templates'
+editor_css: ''
+view_css: ''
diff --git a/config/schema/wysiwyg_template.schema.yml b/config/schema/wysiwyg_template.schema.yml
index 46c694a..857962c 100644
@junaidpv
junaidpv / 3259893-wwm-custom.patch
Created August 2, 2024 19:01
A custom patch to specifcally fix the error reported at https://www.drupal.org/project/file_encrypt/issues/3259893 for WWM sites
diff --git a/src/EncryptStreamWrapper.php b/src/EncryptStreamWrapper.php
index 68b0357..e3e31af 100644
--- a/src/EncryptStreamWrapper.php
+++ b/src/EncryptStreamWrapper.php
@@ -96,7 +96,7 @@ class EncryptStreamWrapper extends LocalStream {
* The base path for encrypt://.
*/
public static function basePath() {
- return Settings::get('encrypted_file_path', '');
+ return Settings::get('encrypted_file_path', \Drupal::getContainer()->getParameter('site.path') . '/private/files-encrypted');
@junaidpv
junaidpv / bwma-migration-address-module.patch
Created July 18, 2024 20:23
Custom patch to help in BWMA migration from D7 to D9. To be removed once the migraiton is over
--- a/src/Plugin/migrate/process/AddressField.php
+++ a/src/Plugin/migrate/process/AddressField.php
@@ -19,6 +19,9 @@
* {@inheritdoc}
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
+ if (empty($value)) {
+ return [];
+ }
$parsed = [
@junaidpv
junaidpv / bwma-migration-entity-reference-revisions.patch
Created July 18, 2024 20:17
Custom patch to help with BWMA migraiton. Not to be used after the migraiton is over.
--- a/src/Plugin/Field/FieldType/EntityReferenceRevisionsItem.php
+++ b/src/Plugin/Field/FieldType/EntityReferenceRevisionsItem.php
@@ -279,7 +279,7 @@
$is_affected = !$this->getFieldDefinition()->isTranslatable() || ($host instanceof TranslatableRevisionableInterface && $host->hasTranslationChanges());
if ($is_affected && !$host->isNew() && $this->entity && $this->entity->getEntityType()->get('entity_revision_parent_id_field')) {
if ($host->isNewRevision()) {
- $this->entity->setNewRevision();
+ $this->entity->setNewRevision(php_sapi_name() != 'cli');
$needs_save = TRUE;
}
@junaidpv
junaidpv / bwma-migration-d9-core.patch
Created July 18, 2024 20:09
This patch contains fixes specified devised for BWMA migraiton from D7 to D9. This can be removed once the migraiton is over.
--- a/core/modules/field/src/Plugin/migrate/field/d7/EntityReference.php
+++ b/core/modules/field/src/Plugin/migrate/field/d7/EntityReference.php
@@ -32,4 +32,15 @@
];
}
+ /**
+ * {@inheritdoc}
+ */
+ public function getFieldWidgetMap() {
@junaidpv
junaidpv / computed_field-fix-deprecation-warnings-2.patch
Created April 29, 2024 15:06
To fix this warning message originated from the computed_field module: Deprecated function: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\Component\Utility\Html::escape() (line 424 of core/lib/Drupal/Component/Utility/Html.php).
diff --git a/src/Plugin/Field/FieldFormatter/ComputedStringFormatter.php b/src/Plugin/Field/FieldFormatter/ComputedStringFormatter.php
index 583c34e..b160b07 100644
--- a/src/Plugin/Field/FieldFormatter/ComputedStringFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/ComputedStringFormatter.php
@@ -60,10 +60,10 @@ class ComputedStringFormatter extends ComputedFormatterBase {
protected function prepareValue($value) {
if ($this->getSetting('sanitized')) {
- return nl2br(Html::escape($value));
+ return !empty($value) ? nl2br(Html::escape($value)) : $value;
@junaidpv
junaidpv / wysiwyg_template-changes-by-rector-for-d10.patch
Last active February 22, 2024 14:27
Changes generated by Rector to make the 3.0.0-rc2 of the wysiwyg_template module work with the D10. Please watch this thread to see if they make a official release of the module for D10.
diff --git a/modules/wysiwyg_template_core/tests/src/Kernel/Plugin/Filter/FilterTemplatesTest.php b/modules/wysiwyg_template_core/tests/src/Kernel/Plugin/Filter/FilterTemplatesTest.php
index 563811a..8663ce4 100644
--- a/modules/wysiwyg_template_core/tests/src/Kernel/Plugin/Filter/FilterTemplatesTest.php
+++ b/modules/wysiwyg_template_core/tests/src/Kernel/Plugin/Filter/FilterTemplatesTest.php
@@ -17,7 +17,7 @@ class FilterTemplatesTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
- public static $modules = ['filter', 'wysiwyg_template_core'];
+ protected static $modules = ['filter', 'wysiwyg_template_core'];
@junaidpv
junaidpv / field-collection-migration-keep-ids.patch
Created December 12, 2023 14:16
Migrate field collections with same ID and revision IDs as D7
diff --git a/migrations/d7_field_collection.yml b/migrations/d7_field_collection.yml
index a7077d3..4c9be52 100644
--- a/migrations/d7_field_collection.yml
+++ b/migrations/d7_field_collection.yml
@@ -8,6 +8,8 @@ deriver: Drupal\paragraphs\Plugin\migrate\D7FieldCollectionItemDeriver
source:
plugin: d7_field_collection_item
process:
+ id: item_id
+ revision_id: revision_id
diff --git a/core/modules/datetime/src/Plugin/views/filter/Date.php b/core/modules/datetime/src/Plugin/views/filter/Date.php
index f73a675fef..a303e3060f 100644
--- a/core/modules/datetime/src/Plugin/views/filter/Date.php
+++ b/core/modules/datetime/src/Plugin/views/filter/Date.php
@@ -109,6 +109,11 @@ protected function opBetween($field) {
// value as UNIX timestamp 0.
$min = (!empty($this->value['min'])) ? $this->value['min'] : '@0';
+ if (!empty($this->value['max']) && !strpos($this->value['max'], ':')) {
+ // No time was specified, so make the date range inclusive.