Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FieldableEntity.php

function FieldableEntity::getEntityTranslationSourceLanguage

Gets an entity source language from the 'entity_translation' table.

Parameters

string $entity_type: The entity type.

int $entity_id: The entity ID.

Return value

string|bool The entity source language or FALSE if no source language was found.

4 calls to FieldableEntity::getEntityTranslationSourceLanguage()
Comment::prepareRow in core/modules/comment/src/Plugin/migrate/source/d7/Comment.php
Adds additional data to the row.
Node::prepareRow in core/modules/node/src/Plugin/migrate/source/d7/Node.php
Adds additional data to the row.
Term::prepareRow in core/modules/taxonomy/src/Plugin/migrate/source/d7/Term.php
Adds additional data to the row.
User::prepareRow in core/modules/user/src/Plugin/migrate/source/d7/User.php
Adds additional data to the row.

File

core/modules/migrate_drupal/src/Plugin/migrate/source/d7/FieldableEntity.php, line 140

Class

FieldableEntity
Base class for D7 source plugins which need to collect field values.

Namespace

Drupal\migrate_drupal\Plugin\migrate\source\d7

Code

protected function getEntityTranslationSourceLanguage($entity_type, $entity_id) {
    try {
        return $this->select('entity_translation', 'et')
            ->fields('et', [
            'language',
        ])
            ->condition('entity_type', $entity_type)
            ->condition('entity_id', $entity_id)
            ->condition('source', '')
            ->execute()
            ->fetchField();
    } catch (\Exception) {
        return FALSE;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal