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

Breadcrumb

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

function ContentEntityBase::getTranslationLanguages

1 call to ContentEntityBase::getTranslationLanguages()
Node::preSave in core/modules/node/src/Entity/Node.php
Acts on an entity before the presave hook is invoked.

File

core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 1039

Class

ContentEntityBase
Implements Entity Field API specific enhancements to the Entity class.

Namespace

Drupal\Core\Entity

Code

public function getTranslationLanguages($include_default = TRUE) {
    $translations = array_filter($this->translations, function ($translation) {
        return $translation['status'];
    });
    unset($translations[LanguageInterface::LANGCODE_DEFAULT]);
    if ($include_default) {
        $translations[$this->defaultLangcode] = TRUE;
    }
    // Now load language objects based upon translation langcodes.
    return array_intersect_key($this->getLanguages(), $translations);
}

API Navigation

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