I am planning to make a module whose controller is called or method in that controller executes when a node is published. The module should be able to get the title and other properties of article that is set to published. Here is controller:
namespace Drupal\my_module\Controller;
use Drupal\Core\Controller\ControllerBase;
class myController extends ControllerBase
{
//Function that should be executed when a specific node is published
public function publish()
{
//here I should get title and other properties of the published node
}
}
I am new to drupal, I have looked into web and found that the solution is related to hooks but I don't know how to use them. Any help regarding the issue will be appreciated.
publish()
exactly do, after getting those node properties?hook_node_presave()
I am not able to get body of node (the content part of article and tags) is there a way to do this?