Posts

Free Drupal themes to look for

Themes https://www.drupal.org/project/bfd https://www.drupal.org/project/catalog_lite https://www.drupal.org/project/global_zymphonies_theme https://www.drupal.org/project/holy https://www.drupal.org/project/mili https://www.drupal.org/project/tara boostrap specific modules https://www.drupal.org/project/bootstrap_layouts

Programatically create layout builder section in Drupal

A sample script which can create a one column layout and store body field in it. namespace Drupal\custommodule\Controller; use Drupal\Core\Controller\ControllerBase; use Drupal\layout_builder\Section; use Drupal\layout_builder\SectionComponent; use Drupal\node\Entity\Node; use Drupal\block\Entity\Block; use Drupal\block_content\Entity\BlockContent; use Drupal\layout_builder\Entity; $entity = Node::load(10);     $section = new Section('layout_onecol');     $uuid = $entity->uuid();     $region = 'content';     $pluginConfiguration = [         'id' => 'field_block:node:article:body',         'provider' => 'layout_builder',         'label_display' => FALSE,         'view_mode' => 'default',         'entity' => $entity->id(),         'context_mapping' => [         ...

Changing the git end point to azure and pushing file using https

configuring azure git end points to existing git repo end point. git remote set-url origin https://azure-end-point git config credential.helper 'store --file ~/.git-credentials-mysite' (the default is stored to "~/.git-credentials". If we want different path then we can use store --file option) git remote show origin (the above command will ask for PAT (personal acces token). When it is given it is strored in git-credentials-mysite) push to remote git push origin --all some helpful commands if remote is gone or upstream is not set git remote add origin https://azure-end-point git branch --set-upstream-to=origin/master master To remove credential helper locally git config --unset credential.helper (this will not delete the file ~/.git-credentials )

PHP compatability checker

https://github.com/Alexia/php7mar Example for Drupal code: phpcs -p . --standard=PHPCompatibility --extensions=module/php,inc/php,install/php,php/php --runtime-set testVersion 7.2

Bootstrap grid generators

http://shoelace.io/ https://www.sitepoint.com/premium/books/bootstrap-related-tools-skills/read/1

Drupal http request

1. Drupal uses stream_context_create to make http request 2. To disable ssl verification you can do following for example, $response = drupal_http_request( $request_uri , array ( 'context' => stream_context_create( array ( 'ssl' => [ 'verify_peer' => FALSE , 'verify_peer_name' => FALSE ])) , )) ;

ESlint with Drupal8

https://www.drupal.org/docs/develop/standards/javascript/eslint-settings npm install --global eslint-config-drupal-bundle - Core developers:  cd core && npm run - script lint : core - js - Contrib developers using new standards:  . / core / node_modules / eslint / . bin / eslint . js -- config = . / core / . eslintrc . json -- ext = . es6 . js modules / my_module / js - Contrib developers using legacy standards:  . / core / node_modules / eslint / . bin / eslint . js -- config = . / core / . eslintrc . lega cy . json -- ext = . js modules / my_module / js . Other notes: https://www.npmjs.com/package/ eslint-config-drupal-bundle https://www.ungm.org/UNUser/ Documents/ DownloadPublicDocument?docId= 771342