Drupal Dump

Drupal Snippets, Hacks and more....

490 posts since 2011

VS Code xdebug array cut of - max children

If you are using VS Code and xdebug you might encounter situation where you dont see all the array entries and drupal has huge arrays, reason for this is xdebug setting and its default, to fix this you need to make script for xdebug like this with  "max_children": 999,

Decoupling simple config or any other drupal data

Using JSON API or commerce api or even JSON API resources is great but it is limited to entities and whole architecture is aimed at them. This is fine in most cases but what if you want to output some config or some random data. You will need to get creative a bit. So what we do is then make custom drupal 8 controller, you setup the usual router yml like

VS Code xdebug on remote server

You may want to xdebug site on remote server, maybe you dont even want to run site locally but just have remote server running the site and codebase to all be there. You could have development server running on some hosting. To do that first you need to 

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}/",
        }
      }
    ]
  }