public function TermStorage::create in Drupal 8
Same name and namespace in other branches
- 9 core/modules/taxonomy/src/TermStorage.php \Drupal\taxonomy\TermStorage::create()
- 10 core/modules/taxonomy/src/TermStorage.php \Drupal\taxonomy\TermStorage::create()
Parameters
array $values: An array of values to set, keyed by property name. A value for the vocabulary ID ('vid') is required.
Overrides EntityStorageBase::create
File
- core/
modules/ taxonomy/ src/ TermStorage.php, line 70
Class
- TermStorage
- Defines a Controller class for taxonomy terms.
Namespace
Drupal\taxonomyCode
public function create(array $values = []) {
// Save new terms with no parents by default.
if (empty($values['parent'])) {
$values['parent'] = [
0,
];
}
$entity = parent::create($values);
return $entity;
}