Save tags to the post
This commit is contained in:
parent
81bc39b5c2
commit
d0b591d57a
|
@ -5,6 +5,7 @@ namespace Drupal\example\Builder;
|
|||
use Drupal\Core\Datetime\DrupalDateTime;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\node\NodeInterface;
|
||||
use Drupal\taxonomy\Entity\Term;
|
||||
|
||||
final class PostBuilder {
|
||||
|
||||
|
@ -79,7 +80,10 @@ final class PostBuilder {
|
|||
|
||||
$tagTerms[] = $term;
|
||||
}
|
||||
|
||||
$post->set('field_tags', $tagTerms);
|
||||
}
|
||||
|
||||
$post->save();
|
||||
|
||||
return $post;
|
||||
|
|
Loading…
Reference in a new issue