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

Breadcrumb

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

function DefaultLanguageItem::applyDefaultValue

Overrides LanguageItem::applyDefaultValue

File

core/modules/language/src/DefaultLanguageItem.php, line 25

Class

DefaultLanguageItem
Alternative plugin implementation of the 'language' field type.

Namespace

Drupal\language

Code

public function applyDefaultValue($notify = TRUE) {
    // Default to LANGCODE_NOT_SPECIFIED.
    $langcode = Language::LANGCODE_NOT_SPECIFIED;
    if ($entity = $this->getEntity()) {
        $langcode = $this->getDefaultLangcode($entity);
    }
    // Always notify otherwise default langcode will not be set correctly.
    $this->setValue([
        'value' => $langcode,
    ], TRUE);
    return $this;
}

API Navigation

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