You are here

protected function DataProviderTaxonomyTerm::setPropertyValues in RESTful 7.2

Overrides DataProviderEntity::setPropertyValues().

This class is created to override this method. This method is overridden to add the vocabulary ID based on the vocabulary machine name when creating a taxonomy term.

Overrides DataProviderEntity::setPropertyValues

File

src/Plugin/resource/DataProvider/DataProviderTaxonomyTerm.php, line 20
Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderEntity.

Class

DataProviderTaxonomyTerm

Namespace

Drupal\restful\Plugin\resource\DataProvider

Code

protected function setPropertyValues(\EntityDrupalWrapper $wrapper, $object, $replace = FALSE) {
  $term = $wrapper
    ->value();
  if (empty($term->vid)) {
    $vocabulary = taxonomy_vocabulary_machine_name_load($term->vocabulary_machine_name);
    $term->vid = $vocabulary->vid;
  }
  parent::setPropertyValues($wrapper, $object, $replace);
}