I want to update or set value of specific node/entity with one button that have function to update specific field on that node / entity?
And put in on view tab on that specific node on a button?
How can I achieve that?
I found that simple code will achieve that:
use Drupal\node\Entity\Node; $nodeObj = Node::load(10); // Loading the Node by its Id. $nodeObj->set('title', 'New title updated'); $nodeObj->set('body', 'The body text has been updated'); $nodeObj->set('field_date', '2017-10-25'); $nodeObj->save(); // Saving the Node object.
But how do I use it, I am new to drupal. Sorry if the question is not good.