In order to avoid sorting out the complicated logic around if an entity exists or not yet (which we didnt break down yet).
We will split that off into a different story.
In order to avoid doing this logic we need to implement a new EntityIdLabelFormatter for federated properties that has most of the same logic as LabelsProviderEntityIdHtmlLinkFormatter but without the entity existing checks.
Roughly speaking this involves removing the following lines,
$title = $this->entityTitleLookup->getTitleForId( $entityId ); // if ( $title === null ) { // return $this->nonExistingFormatter->formatEntityId( $entityId ); // } $term = $this->lookupEntityLabel( $entityId ); // We can skip the potentially expensive isKnown() check if we found a term. if ( $term !== null ) { $label = $term->getText(); // } elseif ( !$title->isKnown() ) { // return $this->nonExistingFormatter->formatEntityId( $entityId ); } else { $label = $entityId->getSerialization(); }
Wiring up this code will be done in T249799