Drush is a command-line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those who spend their working hours hacking away at the command prompt.
I'm trying to load a node with layout builder customized for that node in the drush console.
$ drush php
Psy Shell v0.11.0 (PHP 8.1.3 — cli) by Justin Hileman
Drush Site-Install (Drupal 10.2.8)
>>> $etm=\Drupal::entityTypeManager();
=> Drupal\Core\Entity\EntityTypeManager {#1248}
>>> $ns=$etm->getStorage('node');
=> Drupal\node\NodeStorage {#7630}
>>> $n35=$ns->load(35);
PHP Error: Object of class Drupal\layout_builder\Section could not be converted to string in /app/vendor/drush/drush/src/Psysh/Caster.php on line 46
Expected behavior
Node is loaded.
Workaround
I edited drush/src/Psysh/Caster.php line 46.
// Collapse single value'd field values.
if (count($value[0] ?? []) === 1) {
$to_implode = array_filter(array_column($value, array_keys($value[0])[0]), fn ($v) => is_string($v));
$value = implode(', ', $to_implode);
}
System Configuration
Q
A
Drush version?
12.5.2 (please be specific, and try latest release)
Drupal version?
10.2.8
PHP version
8.1.3
OS?
Linux
With layout builder enabled and made enabled for overrides per node.
Describe the bug
I'm trying to load a node with layout builder customized for that node in the drush console.
Expected behavior
Node is loaded.
Workaround
I edited
drush/src/Psysh/Caster.php
line 46.System Configuration
With layout builder enabled and made enabled for overrides per node.