Skip to content

Instantly share code, notes, and snippets.

View junaidpv's full-sized avatar

Junaid P V junaidpv

View GitHub Profile
@junaidpv
junaidpv / include-aliases-in-export.patch
Created September 20, 2022 15:39
Patch for the menu_export module to include path aliases of menu link internal path in exported data.
diff --git a/src/Form/MenuExportForm.php b/src/Form/MenuExportForm.php
index 2b9a2ac..04a3bb4 100644
--- a/src/Form/MenuExportForm.php
+++ b/src/Form/MenuExportForm.php
@@ -6,6 +6,8 @@ use Drupal\menu_link_content\Entity\MenuLinkContent;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use \Drupal\system\Entity\Menu;
+use Drupal\Core\Url;
+use Drupal\path_alias\Entity\PathAlias;
@junaidpv
junaidpv / handle-order-component-not-preset-error.patch
Created September 16, 2022 15:05
Patch for the commerce_migrate to fIx migraiton error when there is not order component present.
diff --git a/modules/commerce/src/Plugin/migrate/process/commerce1/OrderItemDiscountAdjustment.php b/modules/commerce/src/Plugin/migrate/process/commerce1/OrderItemDiscountAdjustment.php
index 3ece971..45fb789 100644
--- a/modules/commerce/src/Plugin/migrate/process/commerce1/OrderItemDiscountAdjustment.php
+++ b/modules/commerce/src/Plugin/migrate/process/commerce1/OrderItemDiscountAdjustment.php
@@ -116,7 +116,7 @@ class OrderItemDiscountAdjustment extends CommercePrice implements ContainerFact
// Find all price components on the order, not the line item, that are not
// a shipping type and not also in the line item price components.
- $order_components = $row->getSourceProperty('order_components/0/data/components');
+ $order_components = $row->getSourceProperty('order_components/0/data/components') ?? [];
@junaidpv
junaidpv / fullcalendar_view-short-title-for-5.x.patch
Last active December 8, 2023 17:35
To allow to set short title on calender events. Now rewrote to work witih dynamic loading of evetns. Updated for 5.1.13
diff --git a/js/fullcalendar_view.js b/js/fullcalendar_view.js
index b6a6a84..977649b 100644
--- a/js/fullcalendar_view.js
+++ b/js/fullcalendar_view.js
@@ -54,7 +54,7 @@
// Show Tooltip on Mousehover
let thisEvent = info.event;
let des = thisEvent.extendedProps.des;
- let title = thisEvent.title;
+ let title = thisEvent.extendedProps.regular_title;
diff --git a/inline_entity_form.module b/inline_entity_form.module
index 8f6b69d90fb978e6e5759b70b5a55b6bd70beee4..fcc973e1dc3c2dfc8200cf5b2711f61e4518b592 100644
--- a/inline_entity_form.module
+++ b/inline_entity_form.module
@@ -476,11 +476,3 @@ function inline_entity_form_migrate_prepare_row(Row $row, MigrateSourceInterface
\Drupal::classResolver(MigrationHelper::class)
->alterRow($row, $source, $migration);
}
-
-/**
diff --git a/core/modules/views/src/Plugin/views/filter/Date.php b/core/modules/views/src/Plugin/views/filter/Date.php
index 9aa8168f08..7670fbd895 100644
--- a/core/modules/views/src/Plugin/views/filter/Date.php
+++ b/core/modules/views/src/Plugin/views/filter/Date.php
@@ -13,37 +13,52 @@
*/
class Date extends NumericFilter {
- protected function defineOptions() {
- $options = parent::defineOptions();
diff --git a/js/fullcalendar_view.js b/js/fullcalendar_view.js
index 35ad731..500fbfc 100644
--- a/js/fullcalendar_view.js
+++ b/js/fullcalendar_view.js
@@ -35,7 +35,7 @@
// Show Tooltip on Mousehover
let thisEvent = info.event;
let des = thisEvent.extendedProps.des;
- let title = thisEvent.title;
+ let title = thisEvent.extendedProps.regular_title;
@junaidpv
junaidpv / 2943888-148.patch
Last active March 7, 2023 14:16
Patch to add ability to re-purchase a license to extend it. From comment #148 at https://www.drupal.org/project/commerce_license/issues/2943888#comment-14532157 along with minor improvements.
diff --git a/commerce_license.module b/commerce_license.module
index 918daaf..610dd84 100644
--- a/commerce_license.module
+++ b/commerce_license.module
@@ -71,9 +71,24 @@ function commerce_license_commerce_order_item_delete(EntityInterface $entity) {
return;
}
- // Delete the license.
$license = $entity->license->entity;
@junaidpv
junaidpv / mhcc-allow-repurchase-diferent-PV-2943888-148.patch
Created May 20, 2022 11:22
Patch to be used on top of https://www.drupal.org/project/commerce_license/issues/2943888#comment-14532157 to fix the issue allow re-purchaing differnet PV role licesnse. This patch is specific for MHCC site.
diff --git a/src/Entity/License.php b/src/Entity/License.php
index 6e18a95..e160a43 100644
--- a/src/Entity/License.php
+++ b/src/Entity/License.php
@@ -12,6 +12,7 @@ use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityChangedTrait;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
+use Drupal\commerce_order\Entity\OrderItemInterface;
@junaidpv
junaidpv / commerce-order-field-group-migration-fix.patch
Created April 29, 2022 09:45
Patch for field group module to fix error with migrating fied group on commerce order
diff --git a/contrib/field_group_migrate/src/Plugin/migrate/destination/d7/FieldGroup.php b/contrib/field_group_migrate/src/Plugin/migrate/destination/d7/FieldGroup.php
index 35266ae..657573d 100644
--- a/contrib/field_group_migrate/src/Plugin/migrate/destination/d7/FieldGroup.php
+++ b/contrib/field_group_migrate/src/Plugin/migrate/destination/d7/FieldGroup.php
@@ -26,6 +26,11 @@ class FieldGroup extends DestinationBase {
$values[$id] = $row->getDestinationProperty($id);
}
+ // Fix commerce_order bundle, there is no only one order type.
+ if ('commerce_order' == $values['entity_type']) {
@junaidpv
junaidpv / drupallink-not-act-on-anchor-links.patch
Last active December 5, 2023 15:09
Patch for Drupal CKeditor contrib module 1.0.2. Make drupal link ckeditor plugin not to act on links added with anchor link plugin.