So you have a regular list text field in your entity and instead of keys, you want to get values. How do you do that? Well as usual in Drupal it will be painful 🤕 but possible 🙌:
$node->toUrl()->toString();
😭😭😭
So, I have a node that has an entity reference field field_book that points to another node (obviously, a Book node).
So now I want to get a title of the referenced book node. How do I do that?
// Switch to external database\Drupal\Core\Database\Database::setActiveConnection('d7migration');// Get the connection$db = \Drupal\Core\Database\Database::getConnection();$query = $db->select('node', 'n');$query->fields('n', array('title'…
// Switch to external database\Drupal\Core\Database\Database::setActiveConnection('d7migration');// Get the connection$db = \Drupal\Core\Database\Database::getConnection();$query = $db->select('node', 'n');$query->fields('n', array('title'
$query = \Drupal::database()->select('node', 'n');$query->fields('n', ['title', 'status']);$result = $query->execute();foreach ($result as $row) { print($row->title); print($row->status);}