Save tags to the post

This commit is contained in:
Oliver Davies 2024-01-18 13:25:17 +00:00
parent 81bc39b5c2
commit d0b591d57a

View file

@ -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;