Posts

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

Gitlab CI Drupal 8 example

https://guillaumeduveau.com/fr/drupal/8/integration-continue-gitlab-ci-ansible General concepts of running gitlab ci. 1. Install gitlab runner on a server You will be asked to give a url and a token You can take it from your account -> settings -> ci-cd -> Runners Gitlab will use this token to make a api call to run the runner. 2. Generate a private key  in the server and use that as a variable SSH_PRIVATE_KEY in your account -> settings -> ci-cd -> Variables

All about APIs in Drupal8

node/1?_format=json restfult services in D8 => provides config entity https://dev.acquia.com/blog/decoupling-drupal-8-core-core-rest-hal-and-setting-up-drupal-as-a-web-services-provider/29/03/2018/19311 https://wimleers.com/blog/restless-week   https://drupal.stackexchange.com/questions/201800/how-to-expose-paging-data-in-rest-export-views   <entitytype><bundle><uuid> Look for data attributer in the response jsonapi/node/article/?page[offset]=0&page[limit]=1 /jsonapi/view/view/ /jsonapi/view/view/<uuid> for search_api: https://glamanate.com/blog/using-json-api-query-your-search-api-indexes for views: https://www.drupal.org/project/jsonapi/issues/2944204 https://gist.github.com/e0ipso/efcc4e96ca2aed58e32948e4f70c2460   https://www.drupal.org/forum/support/module-development-and-code-questions/2015-11-18/how-do-i-consume-json-from-other   https://github.com/byteparity/rest-api-drupal8 ...

Composer commands

Installing composer packages behind proxy Dont try to install composer packages with sudo. export HTTPS_PROXY_REQUEST_FULLURI=false Other commands: 1. use  composer prohibits package-name to find out the dependency issue with installing that package 2. use composer info package-name to find out what other libraries that package requires If http request failing then force using https. > composer config -g repo.packagist composer https://packagist.org https://github.com/composer/composer/issues/5656#issuecomment-246103054 Install dev modules. Example: local: composer require --dev 'drupal/devel:^4.0' prod:  composer install --no-dev Install new modules: https://stackoverflow.com/questions/15212381/composer-how-can-i-install-another-dependency-without-updating-old-ones Composer cheatsheet https://devhints.io/composer In docker composer If you cant run composer https://stackoverflow.com/questions/28721699/root-password-inside-a-docker-container

PHP Compatability checker

PHPcompatability checker: https://www.drupal.org/node/2924272   https://github.com/PHPCompatibility/PHPCompatibility phpcs - p . -- standard = PHPCompatibility -- extensions = module / php , inc / php , install / php , php / php -- runtime - set testVersion 7.1

Revert a particular git commit

Assume that you commit a change, pushed and there is also a merge commit. Now you want to revert that particular commit. Do the following > git revert <that_particular_merge_hash> -m 1 This automatically creates a commit with the reverted changes. Now push again.