function LanguageItem::setValue
Same name in other branches
- 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php \Drupal\Core\Field\Plugin\Field\FieldType\LanguageItem::setValue()
- 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php \Drupal\Core\Field\Plugin\Field\FieldType\LanguageItem::setValue()
- 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php \Drupal\Core\Field\Plugin\Field\FieldType\LanguageItem::setValue()
Overrides FieldItemBase::setValue
2 calls to LanguageItem::setValue()
- DefaultLanguageItem::applyDefaultValue in core/
modules/ language/ src/ DefaultLanguageItem.php - Applies the default value.
- LanguageItem::applyDefaultValue in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ LanguageItem.php - Applies the default value.
File
-
core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldType/ LanguageItem.php, line 71
Class
- LanguageItem
- Defines the 'language' entity field item.
Namespace
Drupal\Core\Field\Plugin\Field\FieldTypeCode
public function setValue($values, $notify = TRUE) {
// Treat the values as property value of the language property, if no array
// is given as this handles language codes and objects.
if (isset($values) && !is_array($values)) {
$this->set('language', $values, $notify);
}
else {
// Make sure that the 'language' property gets set as 'value'.
if (isset($values['value']) && !isset($values['language'])) {
$values['language'] = $values['value'];
}
parent::setValue($values, $notify);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.