public function populateEntityReferenceField($field_name) {
    $item = $this->item;
    $node = [];
    if (!empty($item[$field_name])) {
      $data = $this->loadDataArray('node');

      foreach ($item[$field_name] as $k => $value) {
        if (!empty($data[$value])) {
          $title = $data[$value]['title'];
          $entities = $this->loadEntitiesByProperties('node', ['title' => $title]);

          foreach ($entities as $entity) {
            $node[] = ['target_id' => $entity->id()];
          }
        }
      }
    }
    return $node;
  }
public function populateEntityReferenceField($field_name) {
    $item = $this->item;
    $node = [];
    if (!empty($item[$field_name])) {
      $data = $this->loadDataArray('node');

      foreach ($item[$field_name] as $k => $value) {
        if (!empty($data[$value])) {
          $title = $data[$value]['title'];
          $entities = $this->loadEntitiesByProperties('node', ['title' => $title]);

          foreach ($entities as $entity) {
            $node[] = ['target_id' => $entity->id()];
          }
        }
      }
    }
    return $node;
  }
public function populateEntityReferenceField ( $ field_name ) { $ item = $ this -> item ; $ node = [ ] ; if ( ! empty ( $ item [ $ field_name ] ) ) { $ data = $ this -> loadDataArray ( 'node' ) ; foreach ( $ item [ $ field_name ] as $ k => $ value ) { if ( ! empty ( $ data [ $ value ] ) ) { $ title = $ data [ $ value ] [ 'title' ] ; $ entities = $ this -> loadEntitiesByProperties ( 'node' , [ 'title' => $ title ] ) ; foreach ( $ entities as $ entity ) { $ node [ ] = [ 'target_id' => $ entity -> id ( ) ] ; } } } } return $ node ; }
Finds nodes by machine name.

@param string $field_name
Field name.

@return array
Returns entities.
Finds nodes by machine name .