Skip to content

Instantly share code, notes, and snippets.

View junaidpv's full-sized avatar

Junaid P V junaidpv

View GitHub Profile
@junaidpv
junaidpv / linkit-old-linkit-icon.patch
Created March 15, 2022 07:04
Patch for Drupal module linkit 6.0.0-beta3 to use old icon.
diff --git a/images/linkit.png b/images/linkit.png
new file mode 100644
index 0000000000000000000000000000000000000000..90fc72ee76c345a5187705319d0eb10cd07f11ba
GIT binary patch
literal 539
zcmV+$0_6RPP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV0005vNkl<ZI1%kp
zK}!Nb6dt1vE**{13<4FzR;|cDaD(#b9=&uisqpB%OKpd!bDfe--971{OH!vuvr8o?
zE+t_|K_1F=XLX(43>h2PKWK(;=FK<n&G+qFg#L$#wm_1k;rdH`PsQpQR`EChVGSb<
zYrC4JA*HSCV2qKfs;HxNUb@}xsnu%TE*6U&*1}jUcCfLzaouP%9*JSh&dm~!$75g!
zsnu#vypO-O*=+l?c$hBl&G+@A!=v+fJpKvsG<86gsUmd($%w!-!Q?nj&StZ(;cz$x
<?php
// Get connection to D7 database.
$d7_database = \Drupal\Core\Database\Database::getConnection('default', 'migrate');
$query = $d7_database->query("SELECT tid FROM {taxonomy_term_data} ORDER BY tid");
$fp = fopen("d7-tids.csv", 'w');
foreach ($query as $row) {
fputcsv($fp, (array)$row);
}
fclose($fp);
<?php
// Get connection to D7 database.
$d7_database = \Drupal\Core\Database\Database::getConnection('default', 'migrate');
$query = $d7_database->query("SELECT uid FROM {users} ORDER BY uid");
$fp = fopen("d7-uids.csv", 'w');
foreach ($query as $row) {
fputcsv($fp, (array)$row);
}
fclose($fp);
<?php
// Get connection to D7 database.
$d7_database = \Drupal\Core\Database\Database::getConnection('default', 'migrate');
$query = $d7_database->query("SELECT fid FROM {file_managed} ORDER BY fid");
$fp = fopen("d7-fids.csv", 'w');
foreach ($query as $row) {
fputcsv($fp, (array)$row);
}
fclose($fp);
<?php
// Get connection to D7 database.
$d7_database = \Drupal\Core\Database\Database::getConnection('default', 'migrate');
$query = $d7_database->query("SELECT nid FROM {node} ORDER BY nid");
$fp = fopen("d7-nids.csv", 'w');
foreach ($query as $row) {
fputcsv($fp, (array)$row);
}
fclose($fp);
@junaidpv
junaidpv / 2903336-1076-note_39871.patch
Created February 2, 2022 13:18
To bring token feature in link field type. Patch taken from MR https://www.drupal.org/project/drupal/issues/2903336#mr1076-note39871
diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php
index 776a8f778ad818cc3b0ad8add6f5ff91d221c6c2..580ab63d4e37170c2d9d1825bfd3c9c65d92d626 100644
--- a/core/lib/Drupal/Core/Url.php
+++ b/core/lib/Drupal/Core/Url.php
@@ -22,6 +22,7 @@
* - \Drupal\Core\Url::fromRouteMatch()
* - \Drupal\Core\Url::fromUri()
* - \Drupal\Core\Url::fromUserInput()
+ * - \Drupal\Core\Url::fromToken()
*
diff --git a/core/modules/ckeditor/js/ckeditor.es6.js b/core/modules/ckeditor/js/ckeditor.es6.js
index fe0ebb940ffba120872b629d7dd03cefceb58e70..e4f90c2c070dd4b2b361044e92425423e567831e 100644
--- a/core/modules/ckeditor/js/ckeditor.es6.js
+++ b/core/modules/ckeditor/js/ckeditor.es6.js
@@ -382,6 +382,27 @@
}
};
}
+
+ const origBeforeSubmit = Drupal.Ajax.prototype.beforeSubmit;
@junaidpv
junaidpv / UpdateCommands.php
Created December 28, 2021 13:27
Drush command to fix "non-existent config entity name returned by FieldStorageConfigInterface::getBundles()" errors reported at https://www.drupal.org/project/drupal/issues/2916266
<?php
namespace Drupal\my_module\Commands;
use Drush\Commands\DrushCommands;
use Drupal\Core\KeyValueStore\KeyValueFactoryInterface;
/**
* A Drush commandfile.
*
diff --git a/core/modules/text/src/Plugin/migrate/field/d7/TextField.php b/core/modules/text/src/Plugin/migrate/field/d7/TextField.php
index 2d2396ed87..21bcd74d87 100644
--- a/core/modules/text/src/Plugin/migrate/field/d7/TextField.php
+++ b/core/modules/text/src/Plugin/migrate/field/d7/TextField.php
@@ -34,7 +34,7 @@ public function getFieldFormatterType(Row $row) {
break;
case 'string_long':
- $formatter_type = str_replace('text_default', 'basic_string', $formatter_type);
+ $formatter_type = str_replace(['text_default', 'text_plain'], 'basic_string', $formatter_type);