xDebug config in VS Code for lando

To add xdebug config to VS CODE for lando, use this config

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "Listen for XDebug",
        "type": "php",
        "request": "launch",
        "port": 9000,
        "pathMappings": {
          "/app/": "${workspaceFolder}/",
        }
      }
    ]
  }

 

Adding your git ssh keys to docker container (for linux)

I wanted to have an option to use ssh keys I use for git not only on host machine but also on remote one made by docker. To do that I tried several ways how to push this key to container. There are some info on SSH forwarding but in the end what worked best for me is just simple mounting a file (ssh key) to php container (using docker4drupal by wodby).

Copy paste images to CKeditor body field like on Medium

By default you can't copy and paste images from clipboard to text field using CKeditor, I would argue this should even be in core as if you are writing an article this would be very useful to have, even more then what "Media" module brings. So how to add this to drupal. Well not easy as usual :)

How to get which CKEditor version is your drupal installation running?

There is a simple way to do this over dev tools in browser, just to to "node edit" or a place where CKEditor is active and run

alert(CKEDITOR.version);

and you will get the version. Currently, it is at 4.14.1 which is almost the latest in 4.x versions, but there is also 5.x version that drupal is still not using.

PHP Fatal error: entity type does not exist

If you somehow get into this nasty problem, you have probably made some big mistake and now you are missing entity definition in your database. To quickly fix that you need to recreate it, you can use drush for it.  So if you are lucky find in code where this entity was added, probably in some hook_update in module.install file 

Database tables created that are not from entity definitions

If you browse around the DB tables in your drupal site, you might stumble into tables with double underscore names like commerce_order__shipments, this is most probably a table created as part of drupal field API system, mostly created as a multivalue field for some entity. It could be created when user creates field in UI or it could be programmatically made, like here

Getting country name from country code

To get full country name you need to use CountryManager class and you can then get all the info you need.  So lets say you have some country code store in $shipping_code variable, to get full country name

Xdebug profiler on Mac OSx

Calling this 3 commands should help you install qcachegrind so you can read xdebug profiler files you made

# Install qt
brew install qt

# Install qcachegrind
$ brew install qcachegrind
 
# Install graphviz
$ brew install graphviz

run qcachegrind in CLI and it will open up app in window where you can import profile file.