public function LanguageItem::applyDefaultValue in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php \Drupal\Core\Field\Plugin\Field\FieldType\LanguageItem::applyDefaultValue()
Applies the default value.
Parameters
bool $notify: (optional) Whether to notify the parent object of the change. Defaults to TRUE. If a property is updated from a parent object, set it to FALSE to avoid being notified again.
Return value
$this Returns itself to allow for chaining.
Overrides Map::applyDefaultValue
1 method overrides LanguageItem::applyDefaultValue()
- DefaultLanguageItem::applyDefaultValue in core/
modules/ language/ src/ DefaultLanguageItem.php - Applies the default value.
File
- core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ LanguageItem.php, line 88
Class
- LanguageItem
- Defines the 'language' entity field item.
Namespace
Drupal\Core\Field\Plugin\Field\FieldTypeCode
public function applyDefaultValue($notify = TRUE) {
// Default to the site's default language. When language module is enabled,
// this behavior is configurable, see language_field_info_alter().
$this
->setValue([
'value' => \Drupal::languageManager()
->getDefaultLanguage()
->getId(),
], $notify);
return $this;
}