This project is not covered by Drupal’s security advisory policy.

Simple way to create , update entity . The module can support field types in core and paragraph field . Field Reference will create automatically if not exist.

Example 1 (Insert new article ):

   $fields =[ 'title'=>'Article Title', 'Body'=>'<h1>Hello world</h1>', 'field_tags'=>['demo'] ]
   \Drupal::service('crud')->save('node', 'article', $fields);  

Example 2 (Update existing article ):

   /** nid is required to update node  , tags is numeric then it will take the existing taxonomy **/
   $fields =[ 'nid' =>12,'title'=>'Article Title', 'Body'=>'<h1>Hello word</h1>', 'field_tags'=>12 ]
   \Drupal::service('crud')->save('node', 'article', $fields);  

Example 3 (Insert multiple):

\Drupal::service('crud')->save('taxonomy_term', 'field_tags',['sport','education']);

Example 4:

$fields =  [
        'title' => 'Title Sample ',
        'field_media_image' => [
              ['https://cdn.pixabay.com/photo/2017/01/04/15/18/buttons-1952271_1280.png'],
              ['https://cdn.pixabay.com/photo/2017/01/04/15/18/buttons-1952271_1280.png']
        ],
        'field_tags' => [
            [
                "description" => "test description121231",
                "name" => "txt qww",
                "tid" => 66
            ],
            [
                "description" => "test description121231",
                "name" => "txtww"
            ]
        ],
        'field_user' => 4,
        'field_paragraphs'=>[
            [
                'field_image' => 'https://cdn.pixabay.com/photo/2017/01/04/15/18/buttons-1952271_1280.png',
                'field_tags'=> 'sport'
            ],
            [
                'field_image' => 'https://cdn.pixabay.com/photo/2017/01/04/15/18/buttons-1952271_1280.png',
                'field_tags'=> [12,10]
            ]
        ]
    ];
    \Drupal::service('crud')->save('node', 'article', $fields);

Twig function

   {% set fields = { title: 'Article', body : 'Body article' } %}
   {% set node_object = save('node','article',fields) %}

Project information

Releases