You are here

protected function JsonapiHelper::dataLanguageExists in Entity Share 8.2

Same name and namespace in other branches
  1. 8 modules/entity_share_client/src/Service/JsonapiHelper.php \Drupal\entity_share_client\Service\JsonapiHelper::dataLanguageExists()

Check if we try to import an entity in a disabled language.

Parameters

string $langcode: The langcode of the language to check.

string $entity_label: The entity label.

Return value

bool FALSE if the data is not in an enabled language.

1 call to JsonapiHelper::dataLanguageExists()
JsonapiHelper::importEntityListData in modules/entity_share_client/src/Service/JsonapiHelper.php
Use data from the JSON:API to import content.

File

modules/entity_share_client/src/Service/JsonapiHelper.php, line 878

Class

JsonapiHelper
Class JsonapiHelper.

Namespace

Drupal\entity_share_client\Service

Code

protected function dataLanguageExists($langcode, $entity_label) {
  if (is_null($this->languageManager
    ->getLanguage($langcode))) {
    $this->messenger
      ->addError($this
      ->t('Trying to import an entity (%entity_label) in a disabled language.', [
      '%entity_label' => $entity_label,
    ]));
    return FALSE;
  }
  return TRUE;
}