I have a content type which contains school information. School name and school id are two fields in the content type. I have the school ID and I am able to retrieve the node. How do I get the school name? Below is how I retrieve the particular school node. I used the getValue() to retrieve the school name however, I get an empty array as a response for that. I am able to see the school name if I var_dump the school node.
$schoolNode = \Drupal::entityTypeManager() ->getStorage('node') ->loadByProperties(['field_school_id' => $item['schoolId']]); $schoolNode->field_school_name->getValue()