Drupal Dump

Drupal Snippets, Hacks and more....

Adding additional ssh-keys to your .ssh

Usually people will just create one key with just default command 


get a public/private pair in (/Users/my_user/.ssh/id_rsa) and use that for anything, but there is much more to this then that. You can create many keys and use them for separate accounts and also automate that.

For example

How to get values from referenced entity

Assume we have a $node object and it has some reference field, we get to that field with 


where we get array of entites we can loop now, se lets say this reference field is even paragraph which has another reference field in it which is taxonomy term, we will loop this field like this

Coding cron job in Drupal 8

Coding a cron job in drupal 8 is pretty easy. All you have to do is go to your module folder, open .module file and add hook_cron function, so lets add some content with our hook_cron

Add BigInt type of data to your custom entity

To have integer go to BigInt type you will need to use setSettings in your BaseFieldDefinition for your custom entity, with this you will have space for 19 digits numbers, with unsigned property making this all positive numbers.