You are here

protected function JsonapiHelper::dataLanguageExists in Entity Share 8

Same name and namespace in other branches
  1. 8.2 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 JSONAPI to import content.

File

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

Class

JsonapiHelper
Class JsonapiHelper.

Namespace

Drupal\entity_share_client\Service

Code

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