Drupal Dump

Drupal Snippets, Hacks and more....

413 posts since 2011

How to encode json with drupal_http_request in drupal 7

In lots of places you will see how to use drupal_http_request with drupal_http_build_query used on data, which is fine if you want to build regular query data (like the ones you have in URLs when using GET) but if you want to send JSON, you shouldn't use that, instead you need  json_encode function on data.

Solr search, where to find body field

By default body field of a content type will not be shown among the fields to index, which is kind of strange but that is how it is as many other properties and fields of content are there by default.

ESLINT how to setup and use

To use eslint on your site, probably the best idea is to install it locally and do it in drupal core dir as that is location of ESLINT config files that ship by default with drupal core (.eslintrc.json and .eslintignore). So you should go to drupal core directory and then install it via yarn:

Advenced History command in linux / Mac OSx

Recently I started using history command a lot. Just to check what I have done. One thing missing by default is timestamp, I want to know when I did something so to do that you can do this