Drupal Dump

Drupal Snippets, Hacks and more....

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 

Using try catch - php exceptions

Not many devs use try catch in custom code, especially in drupal 7. Thing is that it can save you from bigger problems if you wrap your (bad) code into that block, so lets just make simple example how to use it.

Solr with Drupal and docker (wodby docker4drupal) using search api solr

With docker4drupal its easy to enable solr whith docker-compose, its is also easy to do that with other drupal docker bundles. But to make this work it needs some manual work as well. First you need to make sure solr runs properly, test it, see that url to it shows it runs.

git stash error: unable to unlink old (Permission denied)

When you try to git stash and get some error like "error: unable to unlink old" with permission denied with it, it is at is says permission problem, but not on that file, but directory where that file is.  So go to that folder where the problematic file is (usually it will be default folder) and give that folder permissions to write for user and group.

Deploying big release branches, steps to take (dry run merge and checkup)

If you have big sprint with big amount of task and put all of that into feature branch that you need to deploy (merge to master) then it is good to have one big final checkup before doing that. So what I do is this, go to your master branch and either make one temp branch from it like "master_temp" or do it directly there. For extra caution I use temp branch.