Skip to content

Instantly share code, notes, and snippets.

View msankhala's full-sized avatar
🎯
Focusing

mahesh sankhala msankhala

🎯
Focusing
View GitHub Profile
@msankhala
msankhala / Drupal8HorizontalTabs.php
Created December 14, 2023 12:50 — forked from leymannx/Drupal8HorizontalTabs.php
How to create horizontal tabs programmatically in Drupal 8, requires Field Group module
<?php
// How to create horizontal tabs programmatically in Drupal 8, requires Field Group module
$form = array();
$form['my_field'] = array(
'#type' => 'horizontal_tabs',
'#tree' => TRUE,
'#prefix' => '<div id="unique-wrapper">',
'#suffix' => '</div>',
);
$items = array(
@msankhala
msankhala / CustomSerializer.php
Created June 25, 2021 11:50 — forked from BERRAMOU/CustomSerializer.php
Drupal 8 : Custom serializer example to render result as array instead of objects.
<?php
namespace Drupal\MY_MODULE\Plugin\views\style;
use Drupal\rest\Plugin\views\style\Serializer;
/**
* The style plugin for serialized output formats.
*
* @ingroup views_style_plugins
*
@msankhala
msankhala / TopicsSelection.php
Created June 20, 2021 06:29 — forked from hussainweb/TopicsSelection.php
/web/modules/custom/axl_ks_topics/src/Plugin/EntityReferenceSelection/TopicsSelection.php
<?php
namespace Drupal\axl_ks_topics\Plugin\EntityReferenceSelection;
use Drupal\Component\Utility\Html;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginBase;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\Query\QueryInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
@msankhala
msankhala / ComboForm.php
Created June 20, 2021 05:02 — forked from Eyal-Shalev/ComboForm.php
An example form object (Drupal 8) that combines multiple forms into itself.
<?php
namespace Drupal\sandbox\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormInterface;
use Drupal\Core\Form\FormState;
use Drupal\Core\Form\FormStateInterface;
use Drupal\node\Entity\Node;
use Drupal\user\Entity\User;
@msankhala
msankhala / example.php
Created June 10, 2021 07:59 — forked from samuelsolis/example.php
Drupal 8 custom entity without bundle
<?php
/**
* @file
* Contains \Drupal\example\Entity\Example.
*/
namespace Drupal\example\Entity;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\BaseFieldDefinition;

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@msankhala
msankhala / nginx-ssl-config
Created September 9, 2020 06:50 — forked from apollolm/nginx-ssl-config
Nginx Configuration with multiple port apps on same domain, with SSL.
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_geoforce {
server 127.0.0.1:3000;
}
upstream app_pcodes{
server 127.0.0.1:3001;
}
@msankhala
msankhala / analysis.md
Created October 13, 2019 16:41 — forked from azharuddinkhan3005/analysis.md
Custom IF WBs analysis

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
@msankhala
msankhala / DebugTest.php
Created June 27, 2018 14:48 — forked from mortenson/DebugTest.php
Debugging Drupal 8 Javascript tests
<?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 / README.md
Created February 23, 2018 17:49 — forked from jmolivas/README.md
Render a form on a page via a Controller on Drupal8.

Create file at ~/console/chain/generate-controller-form-render.yml containing:

command:
  name: 'generate:controller:form:render'
  description: 'Controller + Form generator'
commands:
  - command: 'generate:module'
    options:
        module: example