Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

mahesh sankhala msankhala

🎯
Focusing
Block or report user

Report or block msankhala

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@msankhala
msankhala / analysis.md
Created Oct 13, 2019 — forked from azharuddinkhan3005/analysis.md
Custom IF WBs analysis
View analysis.md

Workbooks that were referenced during analysis.(The state of the WBs when referred to, were dated between 20th Aug - 22nd Aug 2019)

  1. UPR - Asia Shared Site - UPR - New Client Request Form_v2.0 (1)
  2. Unilever - Crown NAM - New Client Request Form - UL Domestic v2.6
  3. TWE - New Client Request Form+Custom IF with CP v16
  4. Volvo - Crown Global - New Client Request Form_Volvo_v1.4
  5. BP - Asia - New Client Request Form_British Petroleum Asia Pacific v1.6
  6. HAVI - NAM Client Configuration Workbook v1.8

CDS Mapping

After having a look into the CDS mapping sheet of the above mentioned WBs, I came across three patterns
View create-custom-info-hook.php
<?php
// Drupal 7 implement your custom hook_info()
/**
* Gets information about a authentication module.
*
* @param string $module
* The module to get info for.
* @return mixed
* The information array, or FALSE if the information wasn't found.
@msankhala
msankhala / cloudSettings
Last active Dec 13, 2018
Visual Studio Code Settings Sync Gist For Crown
View cloudSettings
{"lastUpload":"2018-12-13T06:36:50.772Z","extensionVersion":"v3.2.3"}
@msankhala
msankhala / cloudSettings
Last active Jul 3, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-07-03T20:29:39.254Z","extensionVersion":"v3.2.9"}
@msankhala
msankhala / render-a-single-field-of-an-entity.php
Created Sep 11, 2018
Render a single field of an entity
View render-a-single-field-of-an-entity.php
use Drupal\node\Entity\Node;
$render = [];
$entity_type_manager = \Drupal::entityTypeManager();
$entity = $entity_type_manager->getStorage($entity_type)->load($entity_id);
$fields = [
'body',
'field_example'
];
if ($entity) {
@msankhala
msankhala / Trait-static-method.php
Last active Jul 21, 2018
Trait and static method.
View Trait-static-method.php
<?php
/**
* FileGenerator.
*/
trait FileGeneratorTrait
{
public static function generateFile() {
echo "generating file \n";
}
@msankhala
msankhala / DebugTest.php
Created Jun 27, 2018 — forked from mortenson/DebugTest.php
Debugging Drupal 8 Javascript tests
View DebugTest.php
<?php
class DebugTest extends YourBrokenTest {
/**
* Overrides a broken test method and saves HTML at the point of failure.
*/
public function testName() {
try {
parent::testName();
@msankhala
msankhala / Symfony-Service-container-cheetsheet.md
Created May 7, 2018
symfony dependency injection cheet sheet.
View Symfony-Service-container-cheetsheet.md

Symfony Service container cheetsheet:

https://symfony.com/doc/current/service_container.html

Passing arguments to service:

services:
  site_update_manager.superadmin:
    class: App\Updates\SiteUpdateManager
    # you CAN still use autowiring: we just want to show what it looks like without
View d8-entity-api-cheet-sheet.md

Drupal 8 Entity API cheat sheet

The examples here contain some hard-coded IDs. These are all examples. In your real code, you should already have the node IDs, file IDs, etc. in a variable.

Working with nodes

Load a node by NID:

$nid = 123;     // example value
$node_storage = \Drupal::entityTypeManager()->getStorage('node');
$node = $node_storage->load($nid);
@msankhala
msankhala / html5-custom-validation-pattern.js
Created May 1, 2018
html5-custom-validation-pattern.js
View html5-custom-validation-pattern.js
jQuery(document).ready(function(){
jQuery('#edit-default-value-input-field-email-0-value').on('input', function(event){
var constraint = new RegExp(/^\[[\w\d][\w\d_\-]*:[\w\d_\-]*\]$/);
if (constraint.test(event.target.value)) {
console.log(event.target);
this.setCustomValidity('');
}
else {
console.log(event.target);
this.setCustomValidity('This is not a valid token');
You can’t perform that action at this time.