Skip to content

Instantly share code, notes, and snippets.

@freshjones
Created April 30, 2015 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freshjones/8ae24b6f32ee44ea265d to your computer and use it in GitHub Desktop.
Save freshjones/8ae24b6f32ee44ea265d to your computer and use it in GitHub Desktop.
save portion of node
<?php
$entity = node_load(33);
echo "on load: {$entity->field_test1[LANGUAGE_NONE][0]['value']}<br/>";
$entity->field_test1[LANGUAGE_NONE][0]['value']='test'.rand(10,100);
echo "before save: {$entity->field_test1[LANGUAGE_NONE][0]['value']}<br/>";
$entity2=new stdClass;
$entity2->nid=$entity->nid;
$entity2->vid=$entity->vid;
$entity2->type=$entity->type;
$entity2->field_annonce=$entity->field_annonce;
field_attach_update('node',$entity2);
$entity = node_load(33);
echo "after save: {$entity->field_test1[LANGUAGE_NONE][0]['value']}<br/>";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment