Created
January 9, 2019 09:16
-
-
Save Eduardo-Morales-Alberti/3b3f21f245b24c5dc4857e19f629c65e to your computer and use it in GitHub Desktop.
Edit paragraph wrapper Drupal 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Drupal\paragraphs\Entity\Paragraph; | |
$p_wrapper = \Drupal::entityTypeManager()->getStorage('paragraph_wrapper')->load('17522'); | |
$paragraph_item = Paragraph::create([ | |
'type' => 'html', | |
'title' => 'Testing', | |
'field_texto_largo_con_formato' => 'body test', | |
]); | |
$paragraph_item->save(); | |
$p_wrapper->set('paragraph_items', [ | |
[ | |
'target_id' => $paragraph_item->id(), | |
'target_revision_id' => $paragraph_item->getRevisionId(), | |
], | |
]); | |
$p_wrapper->save(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment